You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running dotnet format analyzers in a solution with generators leads to a crash, as it tries to import an assembly that isn't referenced anywhere.
To Reproduce
This is certainly not a minimal example, but if this is just user error I don't want to spend more time investigating an issue that I caused myself. If this turns out to be an actual bug I'll create a minimal example to reproduce this crash of course.
The dotnet runtime version is '8.0.3'.
Formatting code files in workspace '/mnt/Dev/git-repos/Ryujinx/RyuSOCKS/RyuSocks.sln'.
Determining projects to restore...
All projects are up-to-date for restore.
Project RyuSocks is using configuration from '/mnt/Dev/git-repos/Ryujinx/RyuSOCKS/.editorconfig'.
Project RyuSocks is using configuration from '/mnt/Dev/git-repos/Ryujinx/RyuSOCKS/RyuSocks/obj/Debug/net8.0/RyuSocks.GeneratedMSBuildEditorConfig.editorconfig'.
Project RyuSocks is using configuration from '/usr/share/dotnet/sdk/8.0.203/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_8_default.globalconfig'.
Project RyuSocks.Generator is using configuration from '/mnt/Dev/git-repos/Ryujinx/RyuSOCKS/.editorconfig'.
Project RyuSocks.Generator is using configuration from '/mnt/Dev/git-repos/Ryujinx/RyuSOCKS/RyuSocks.Generator/obj/Debug/netstandard2.0/RyuSocks.Generator.GeneratedMSBuildEditorConfig.editorconfig'.
Project RyuSocks.Test is using configuration from '/mnt/Dev/git-repos/Ryujinx/RyuSOCKS/.editorconfig'.
Project RyuSocks.Test is using configuration from '/mnt/Dev/git-repos/Ryujinx/RyuSOCKS/RyuSocks.Test/obj/Debug/net8.0/RyuSocks.Test.GeneratedMSBuildEditorConfig.editorconfig'.
Project RyuSocks.Test is using configuration from '/usr/share/dotnet/sdk/8.0.203/Sdks/Microsoft.NET.Sdk/analyzers/build/config/analysislevel_8_default.globalconfig'.
Unhandled exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Composition.AttributedModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'System.Composition.AttributedModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element, Boolean inherit)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerFinderHelpers.IsExportedForLanguage(Type codeFixProvider, String language)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerFinderHelpers.<>c__DisplayClass0_0.<LoadFixers>b__1(Type t)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerFinderHelpers.LoadFixers(IEnumerable`1 assemblies, String language)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerReferenceInformationProvider.GetAnalyzersAndFixers(Workspace workspace, Project project)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerReferenceInformationProvider.<>c__DisplayClass3_0.<GetAnalyzersAndFixers>b__1(Project project)
at System.Collections.Immutable.ImmutableDictionary.<>c__DisplayClass9_0`3.<ToImmutableDictionary>b__0(TSource element)
at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource x)
at System.Linq.Enumerable.SelectIListIterator`2.MoveNext()
at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 items, MutationInput origin, KeyCollisionBehavior collisionBehavior)
at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 pairs, Boolean avoidToHashMap)
at System.Collections.Immutable.ImmutableDictionary`2.AddRange(IEnumerable`1 pairs)
at System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary[TSource,TKey,TValue](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 keyComparer, IEqualityComparer`1 valueComparer)
at System.Collections.Immutable.ImmutableDictionary.ToImmutableDictionary[TSource,TKey,TValue](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerReferenceInformationProvider.GetAnalyzersAndFixers(Workspace workspace, Solution solution, FormatOptions formatOptions, ILogger logger)
at Microsoft.CodeAnalysis.Tools.Analyzers.AnalyzerFormatter.FormatAsync(Workspace workspace, Solution solution, ImmutableArray`1 formattableDocuments, FormatOptions formatOptions, ILogger logger, List`1 formattedFiles, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.CodeFormatter.RunCodeFormattersAsync(Workspace workspace, Solution solution, ImmutableArray`1 formattableDocuments, FormatOptions formatOptions, ILogger logger, List`1 formattedFiles, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, String binaryLogPath)
at Microsoft.CodeAnalysis.Tools.FormatCommandCommon.FormatAsync(FormatOptions formatOptions, ILogger`1 logger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.Commands.FormatAnalyzersCommand.FormatAnalyzersHandler.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
The text was updated successfully, but these errors were encountered:
Describe the bug
Running
dotnet format analyzers
in a solution with generators leads to a crash, as it tries to import an assembly that isn't referenced anywhere.To Reproduce
This is certainly not a minimal example, but if this is just user error I don't want to spend more time investigating an issue that I caused myself. If this turns out to be an actual bug I'll create a minimal example to reproduce this crash of course.
https://github.com/TSRBerry/RyuSOCKS/tree/5953fec8b80eb5994c1813fcc3bbf8eff07f3456
Exceptions (if any)
Further technical details
Include the output of `dotnet --info`
Output of `dotnet format analyzers -v d`
The text was updated successfully, but these errors were encountered: