-
Notifications
You must be signed in to change notification settings - Fork 507
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
SA1135 throws null reference exception when using dotnet core 3.1.2 #3136
Comments
Fix build due to SA1135 when build with .Net Core 3.1. Will re-enable it once DotNetAnalyzers/StyleCopAnalyzers#3136 is resolved.
This issue is caused by the Roslyn compiler change introduced with dotnet/roslyn#41828. Since then, Line 98 in 7c80b00
And then this line throws: StyleCopAnalyzers/StyleCop.Analyzers/StyleCop.Analyzers/Helpers/SymbolNameHelpers.cs Line 40 in b6b9b02
Interestingly enough, there are a couple of unit tests that should cover this use case:
However, they seem to not cover the expected case. Despite the passing results, the tests don't actually run the code causing the NRE. The reason is: (The concrete symbol descriptor object is I tried to use typeSymbol.TupleUnderlyingType() ?? typeSymbol (like it's being used in Roslyn now, see e.g. this), but that didn't really work because @sharwell Could you maybe outline a solution for this or give me an idea? I'd be glad to help by providing a PR. I'm confused by the fact that |
I have failing unit tests after updating the Microsoft.CodeAnalysis package in the StyleCop.Analyzers.Test.CSharp8 project to version 3.6.0. I'll have a look on how to fix this. |
im still getting this. using .NET 8 (c#). error: CSC : error AD0001: Analyzer 'StyleCop.Analyzers.LayoutRules.SA1500BracesForMultiLineStatementsMustNotShareLine' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. (some path to my csproj file) inclusion in project: tried to ignore it in the ".editconfig" file: broken code comented outdotnet_diagnostic.AD0001.severity = None not using a "stylecop.json" file. running the command: "dotnet build MySolution.sln --no-restore --configuration Release /p:RunAnalyzersDuringBuild=true -warnaserror" any ideas? |
@matan-yadgar This issue was about SA1135 throwing exceptions and in your case it's SA1500, so it's not the same problem. If you are not using the latest beta (1.2.0-beta.556), please try that one. Otherwise create a new issue and someone can try to help you. |
I am currently updating the iotedge repo to from dotnet core 2.1.13 to 3.1.2.
I ran into the following error when executing
dotnet build -c release
, which uses stylecop.I also tested on dotnet core 3.1.102 and this does not occur.
The text was updated successfully, but these errors were encountered: