Closed BatanGaming closed 4 months ago
Microsoft.CodeAnalysis, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35
This assembly isn't part of or referenced by the SDK 8.0.300. I have no idea how this message could be appearing.
Microsoft.CodeAnalysis, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35
This assembly isn't part of or referenced by the SDK 8.0.300. I have no idea how this message could be appearing. Here's the screenshot if it helps. Different files can give different error message...
Version 42.42.42.42 is a designator for an assembly which is not part of an official build or distribution. Something has provided and loaded an assembly which isn't part of the SDK or Visual Studio; we'd need to locate the specific assembly that is being loaded to understand why it exists on the machine in question.
we'd need to locate the specific assembly that is being loaded to understand why it exists on the machine in question.
I'm encountering this exception with ReSharper cli which can run Roslyn analyzer while inspecting: https://github.com/n0099/open-tbm/actions/runs/9141114339/job/25135170215
Warning: "[AD0001] Analyzer 'Microsoft.CodeAnalysis.CodeStyle.CSharpFormattingAnalyzer' threw an exception of type 'System.TypeLoadException' with message 'Could not load type 'Microsoft.CodeAnalysis.SyntaxList' from assembly 'Microsoft.CodeAnalysis, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.'.
Exception occurred with following context:
Compilation: tbm.Crawler
SyntaxTree: /home/runner/work/open-tbm/open-tbm/c#/crawler/Program.cs
System.TypeLoadException: Could not load type 'Microsoft.CodeAnalysis.SyntaxList' from assembly 'Microsoft.CodeAnalysis, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at Microsoft.CodeAnalysis.CSharp.Extensions.MemberDeclarationSyntaxExtensions.GetAttributes(MemberDeclarationSyntax member)
at Microsoft.CodeAnalysis.CSharp.Formatting.FormattingHelpers.GetFirstAndLastMemberDeclarationTokensAfterAttributes(MemberDeclarationSyntax node)
at Microsoft.CodeAnalysis.CSharp.Formatting.SuppressFormattingRule.AddSpecificNodesSuppressOperations(List`1 list, SyntaxNode node)
at Microsoft.CodeAnalysis.Formatting.Rules.NextSuppressOperationAction.Invoke()
at Microsoft.CodeAnalysis.CSharp.Formatting.ElasticTriviaFormattingRule.AddSuppressOperations(List`1 list, SyntaxNode node, NextSuppressOperationAction& nextOperation)
at Microsoft.CodeAnalysis.Formatting.Rules.NextSuppressOperationAction.Invoke()
at Microsoft.CodeAnalysis.CSharp.Formatting.SpacingFormattingRule.AddSuppressOperations(List`1 list, SyntaxNode node, NextSuppressOperationAction& nextOperation)
at Microsoft.CodeAnalysis.Formatting.Rules.NextSuppressOperationAction.Invoke()
at Microsoft.CodeAnalysis.CSharp.Formatting.WrappingFormattingRule.AddSuppressOperations(List`1 list, SyntaxNode node, NextSuppressOperationAction& nextOperation)
at Microsoft.CodeAnalysis.Formatting.ChainedFormattingRules.AddSuppressOperations(List`1 list, SyntaxNode currentNode)
at Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.AddOperations[T](SegmentedList`1 operations, List`1 scratch, SyntaxNode node, Action`2 addOperations)
at Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.CreateNodeOperations(CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Formatting.AbstractFormatEngine.Format(CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Formatting.AbstractSyntaxFormatting.GetFormattingResult(SyntaxNode node, IEnumerable`1 spans, SyntaxFormattingOptions options, IEnumerable`1 rules, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CodeStyle.FormattingAnalyzerHelper.AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context, ISyntaxFormatting formattingProvider, DiagnosticDescriptor descriptor, SyntaxFormattingOptions options)
at Microsoft.CodeAnalysis.CodeStyle.AbstractFormattingAnalyzer.<>c__DisplayClass4_0.<InitializeWorker>b__1(SyntaxTreeAnalysisContext treeContext)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Compilers\Core\Portable\DiagnosticAnalyzer\AnalyzerExecutor.cs:line 1185
-----
Suppress the following diagnostics to disable this analyzer: IDE0055" on /home/runner/work/open-tbm/open-tbm/c#/crawler/Program.cs
This only happens to this muno92/resharper_inspectcode
action, not in Visual Studio or msbuild
cli.
Analyzer packages being used: https://github.com/n0099/open-tbm/blob/724585d238a3808ba6e85fbac7f24d701e693634/c%23/shared/tbm.Shared.csproj#L18-L27
Since there is no way to link this issue to a product we create or distribute, I'm going to resolve this issue as Won't Fix. The publisher of the unofficial compiler package would be responsible for addressing this.
See dotnet/roslyn#73508 which looks closely related.
I have a reproduction of this particular error for anyone interested. See https://github.com/JensDll/LoadError and the latest workflow runs. As far as I can tell, this error is caused by an incompatibility between some built-in analyzers of SDK 8.0.300
and an older version of Microsoft.CodeAnalysis.dll
. So anyone fixing this must make sure the newer assemblies are findable when loading the latest analyzers.
This is likely an issue at the jetbrain side, see - https://youtrack.jetbrains.com/issue/RIDER-111443/Roslyn-analyzer-failure-with-.NET-8-SDK-preview-8.0.300-preview.24203.14-and-8.0.300-release
I downgraded the SDK to 8.0.2xx to temporarily work around the issue.
Analyzer source
SDK: Built-in CA analyzers in .NET 5 SDK or later
Version: SDK 8.0.300
Describe the bug
Rider gives error in each file
AD0001: Analyzer 'Microsoft.CodeAnalysis.CodeStyle.CSharpFormattingAnalyzer' threw an exception of type 'System.TypeLoadException' with message 'Could not load type 'Microsoft.CodeAnalysis.SyntaxList' from assembly 'Microsoft.CodeAnalysis, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.'.
Also
IDE0100
gives false positive result on== false
, like thiswhere ep.Archived == false
Which was not the case before on SDK version 8.0.204