Skip to content

[Bug]: CS8032: Analyzer couldn't be created #51

@fubar-coder

Description

@fubar-coder

Describe the bug 🐞

This are the error message:

CSC : warning CS8032: An instance of analyzer ReactiveUI.SourceGenerators.AsyncVoidReturningReactiveCommandMethodAnalyzer cannot be created from C:\Users\Mark Junker\.nuget\packages\reactiveui.sourcegenerators\1.1.31\analyzers\dotnet\cs\ReactiveUI.SourceGenerators.dll : Exception has been thrown by the target of an invocation.. [C:\Users\Mark Junker\source\repos\TestReactiveUiSourceGenBug2\TestReactiveUiSourceGenBug2.csproj]
CSC : warning AD0001: Analyzer 'ReactiveUI.SourceGenerators.CodeAnalyzers.PropertyToReactiveFieldAnalyzer' threw an exception of type 'System.TypeInitializationException' with message 'The type initializer for 'ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors' threw an exception.'. [C:\Users\Mark Junker\source\repos\TestReactiveUiSourceGenBug2\TestReactiveUiSourceGenBug2.csproj]
CSC : warning AD0001: Analyzer 'ReactiveUI.SourceGenerators.UnsupportedCSharpLanguageVersionAnalyzer' threw an exception of type 'System.TypeInitializationException' with message 'The type initializer for 'ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors' threw an exception.'. [C:\Users\Mark Junker\source\repos\TestReactiveUiSourceGenBug2\TestReactiveUiSourceGenBug2.csproj]

Step to reproduce

  1. Install .NET SDK 8.0.401
  2. git clone https://github.com/fubar-coder/TestReactiveUiSourceGenBug2.git
  3. dotnet build

Reproduction repository

https://github.com/fubar-coder/TestReactiveUiSourceGenBug2

Expected behavior

No build errors

Screenshots 🖼️

No response

IDE

Visual Studio 2022

Operating system

Windows 11

Version

23H2

Device

Laptop

ReactiveUI Version

20.1.52

Additional information ℹ️

This is the output in the binary build log:

Messages
    Assembly loaded during TaskRun (Microsoft.CodeAnalysis.BuildTasks.Csc): System.IO.Pipes, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.IO.Pipes.dll, MVID: 45a7c5fa-526f-4402-9ea7-748aec4e82fd, AppDomain: Default)
    Assembly loaded during TaskRun (Microsoft.CodeAnalysis.BuildTasks.Csc): System.Security.AccessControl, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.Security.AccessControl.dll, MVID: 8b5250e1-f9c4-43cd-8ac5-9ddb2269c1a2, AppDomain: Default)
    Microsoft (R) Visual C# Compiler version 4.11.0-3.24365.8 (9e9c7c1d)
    Copyright (C) Microsoft Corporation. All rights reserved.
    System.TypeInitializationException: The type initializer for 'ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors' threw an exception.
    ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
    File name: 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    at ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors..cctor()
    --- End of inner exception stack trace ---
    at ReactiveUI.SourceGenerators.CodeAnalyzers.PropertyToReactiveFieldAnalyzer.get_SupportedDiagnostics() in c:\temp\releaser\ReactiveUI.SourceGenerators\src\ReactiveUI.SourceGenerators\CodeAnalyzers\PropertyToReactiveFieldAnalyzer.cs:line 29
    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerManager.AnalyzerExecutionContext.<>c__DisplayClass21_0.<ComputeDiagnosticDescriptors_NoLock>b__0(Object _)
    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken)
    -----
    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
    File name: 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    at ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors..cctor()
    -----
    Analyzer 'ReactiveUI.SourceGenerators.CodeAnalyzers.PropertyToReactiveFieldAnalyzer' threw an exception of type 'System.TypeInitializationException' with message 'The type initializer for 'ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors' threw an exception.'.
    System.TypeInitializationException: The type initializer for 'ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors' threw an exception.
    ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
    File name: 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    at ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors..cctor()
    --- End of inner exception stack trace ---
    at ReactiveUI.SourceGenerators.CodeAnalyzers.PropertyToReactiveFieldAnalyzer.get_SupportedDiagnostics() in c:\temp\releaser\ReactiveUI.SourceGenerators\src\ReactiveUI.SourceGenerators\CodeAnalyzers\PropertyToReactiveFieldAnalyzer.cs:line 29
    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.CreateDisablingMessage(DiagnosticAnalyzer analyzer, String analyzerName)
    -----
    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
    File name: 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    at ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors..cctor()
    -----
    System.TypeInitializationException: The type initializer for 'ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors' threw an exception.
    ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
    File name: 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    at ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors..cctor()
    --- End of inner exception stack trace ---
    at ReactiveUI.SourceGenerators.UnsupportedCSharpLanguageVersionAnalyzer.get_SupportedDiagnostics() in c:\temp\releaser\ReactiveUI.SourceGenerators\src\ReactiveUI.SourceGenerators\Diagnostics\Analyzers\UnsupportedCSharpLanguageVersionAnalyzer.cs:line 36
    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerManager.AnalyzerExecutionContext.<>c__DisplayClass21_0.<ComputeDiagnosticDescriptors_NoLock>b__0(Object _)
    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken)
    -----
    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
    File name: 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    at ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors..cctor()
    -----
    Analyzer 'ReactiveUI.SourceGenerators.UnsupportedCSharpLanguageVersionAnalyzer' threw an exception of type 'System.TypeInitializationException' with message 'The type initializer for 'ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors' threw an exception.'.
    System.TypeInitializationException: The type initializer for 'ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors' threw an exception.
    ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
    File name: 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    at ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors..cctor()
    --- End of inner exception stack trace ---
    at ReactiveUI.SourceGenerators.UnsupportedCSharpLanguageVersionAnalyzer.get_SupportedDiagnostics() in c:\temp\releaser\ReactiveUI.SourceGenerators\src\ReactiveUI.SourceGenerators\Diagnostics\Analyzers\UnsupportedCSharpLanguageVersionAnalyzer.cs:line 36
    at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.CreateDisablingMessage(DiagnosticAnalyzer analyzer, String analyzerName)
    -----
    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Das System kann die angegebene Datei nicht finden.
    File name: 'Microsoft.CodeAnalysis.Workspaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
    at ReactiveUI.SourceGenerators.Diagnostics.DiagnosticDescriptors..cctor()
    -----
    CompilerServer: server - server processed compilation - TestReactiveUiSourceGenBug2 (net8.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions