Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S3237: Rule should not throw NullReferenceException when using expression body accessor #1003

Closed
antrv opened this issue Dec 5, 2017 · 1 comment
Assignees
Labels
Type: Bug Exceptions and blocking issues during analysis.
Milestone

Comments

@antrv
Copy link

antrv commented Dec 5, 2017

Hello,

VS 15.5, SonarAnalyzer.CSharp 6.4 or 6.7

Analyzer 'SonarAnalyzer.Rules.CSharp.UseValueParameter' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
(Could not catch stack trace).
using System;

namespace ConsoleApp8
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, world!");
        }

        public Program(string id)
        {
            if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(nameof(id));
        }

        private string id;

        public string Id
        {
            get => null;
            set => id = value;
        }
    }
}
@sm-g
Copy link

sm-g commented Dec 7, 2017

Have same issue very often from time to time when build solution (it succeed eventually after manual retry).

@Evangelink Evangelink self-assigned this Dec 18, 2017
@Evangelink Evangelink added this to the 6.7.1 milestone Dec 18, 2017
@Evangelink Evangelink added Area: Rules Type: Bug Exceptions and blocking issues during analysis. labels Dec 18, 2017
@Evangelink Evangelink changed the title NullReferenceException in UseValueParameter [VS 15.5 only] Fix S3237: Rule should not throw NullReferenceException when using expression body accessor Dec 18, 2017
@ghost ghost removed the Status: Needs Review label Dec 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Exceptions and blocking issues during analysis.
Projects
None yet
Development

No branches or pull requests

3 participants