Limit reported Metalama exceptions in VS

For whatever reason today, I seem to be encountering an unusual number of exceptions reading "Metalama ran into an unexpected problem: Method not found: 'Metalama.Framework.Engine.Options.MSBuildProjectOptions Metlama.Framework.Engine.Options.MSBuildProjectOptionsFactory.GetProjectOptions(Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptionsProvider, System.Nullable`1<System.Collections.Immutable.ImmutableArray12<System.Object>, Metalama.Compiler.TransformerOptions)'." I'll share the rest of the exception in the message below. My questions though - this is popping up an awful lot and obscuring the warning that indicates I'm editing the aspect with the "I'm done" option to refresh the compiled code. Absent ya'll simply fixing the underlying issue, it possible to 1) limit the number of exceptions shown and/or 2) could the "I'm done with the changes." be placed in a different location in the IDE, separate from the exceptions?
11 Replies
Whit
WhitOP2y ago
Larger exception:
System.MissingMethodException: Method not found: 'Metalama.Framework.Engine.Options.MSBuildProjectOptions Metalama.Framework.Engine.Options.MSBuildProjectOptionsFactory.GetProjectOptions(Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptionsProvider, System.Nullable1<System.Collections.Immutable.ImmutableArray1<System.Object>>, Metalama.Compiler.TransformerOptions)'. at Metalama.Framework.DesignTime.VisualStudio.Classification.DesignTimeClassificationService.GetClassifiedTextSpans(SemanticModel semanticModel, AnalyzerConfigOptionsProvider analyzerConfigOptionsProvider, CancellationToken cancellationToken) at Metalama.Vsx.TextBuffers.TextBufferServicesImpl.<GetClassificationsImplAsync>d26.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Metalama.Vsx.TextBuffers.TextBufferServicesImpl.<GetClassificationsAsync>d25.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Metalama.Vsx.TextBuffers.TextBufferServicesImpl.<GetQuickInfoItemAsync_Source>d33.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Metalama.Vsx.TextBuffers.TextBufferServicesImpl.<GetQuickInfoItemAsync>d32.MoveNext()
Whit
WhitOP2y ago
They just keep coming..
No description
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Whit
WhitOP2y ago
2022 Professional Currently running 17.5.5 What's odd is that the compilation appears to be happening fine as I'm able to see the changes as expected in the preview, but I'm just getting bombarded with these other (seemingly identical) exceptions. I just closed about 40 of them looking for the "I'm done" warning
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Whit
WhitOP2y ago
Lots of changes in 17.6, but none that are wildly relevant to me just yet, so if there's a compatibility issue there, happy holding back in 17.5.5 for now (until I forget and absentmindedly upgrade)
domsinclair
domsinclair2y ago
Try navigating to this folder: C:\Users\dom\AppData\Local\Temp\Metalama\CompileTime\Metalama.Extensions.DependencyIn.netstandard2.0 Obviously substitute your name for mine. Once there delete the folder that ends in b (it will get rebuilt) and see if that makes a difference. I got a whole load of warnings and the like yesterday and one of them just happened to mention deleting that folder and it did appear to make a difference.
Whit
WhitOP2y ago
Just deleted it, switched back to VS and promptly got the same error again. I've got two other folders in there. Is it safe to delete them all? You know what - just realized I was running the non-preview version of Metalama in this class. Upgraded it and while I might be too soon to claim victory, I haven't seen an error yet
domsinclair
domsinclair2y ago
Honestly don't know the answer to that.
Whit
WhitOP2y ago
Yeah, at this point, I have yet to see an error after upgrading Metalama.Framework to 2023.1.1-preview Well, having deleted that folder and restarted VS, I now am getting a new error: "Unexpected exception occurred in Metalama: Could not find a part of the path 'C:\Users\whit\AppData\Local\Temp\Metalama\AssemblyLocator\2023.1.1-preview\default\bin\Debug\net471" It's right - looking at that directory, it goes as far as C:\Users\whit\AppData\Local\Temp\Metalama\AssemblyLocator\2023.1.1-preview\default containing two files: cleanup.json and references.json And from the crash report:
Metalama Version: 2023.1.1-preview Runtime: .NET Framework 4.8.4614.0 Processor Architecture: X64 OS Description: Microsoft Windows 10.0.19044 OS Architecture: X64 Exception type: System.IO.DirectoryNotFoundException Exception message: Could not find a part of the path 'C:\Users\whit\AppData\Local\Temp\Metalama\AssemblyLocator\2023.1.1-preview\default\bin\Debug\net471'. ===== Exception ===== System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\whit\AppData\Local\Temp\Metalama\AssemblyLocator\2023.1.1-preview\default\bin\Debug\net471'. at System.IO.Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileSystemEnumerableIterator1.CommonInit() at System.IO.FileSystemEnumerableIterator1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost) at System.IO.Directory.GetFiles(String path, String searchPattern) at Metalama.Framework.Engine.CompileTime.ReferenceAssemblyLocator..ctor(ProjectServiceProvider serviceProvider) at Metalama.Framework.Engine.CompileTime.ReferenceAssemblyLocatorProvider.GetInstance(ProjectServiceProvider serviceProvider) at Metalama.Framework.Engine.Services.ServiceProviderExtensions.GetReferenceAssemblyLocator(ProjectServiceProvider serviceProvider) at Metalama.Framework.Engine.CompileTime.SystemTypeResolver..ctor(ProjectServiceProvider serviceProvider) at Metalama.Framework.Engine.Services.ServiceProviderFactory.<>c.<WithProjectScopedServices>b9_5(ServiceProvider1 sp) at Metalama.Framework.Engine.Services.ServiceProvider1.WithServiceConditional[T](Func2 func) at Metalama.Framework.Engine.Services.ServiceProviderFactory.WithProjectScopedServices(IServiceProvider1 serviceProvider, IProjectOptions projectOptions, IEnumerable`1 metadataReferences) at Metalama.Framework.Engine.Pipeline.SourceTransformer.Execute(TransformerContext context)
I tried reinstalling the nuget package but to no avail - can't get Metalama to compile in this project at all now Wound up having to delete everything in the \Temp\Metalama folder except the credits/usage folder and it's compiling again
Gael Fraiteur
Gael Fraiteur2y ago
We'll look into that. Regarding DirectoryNotFoundException, we have a fix for it in a build tht was scheduled for next week. We can release it earlier if it's urgent. Filed a ticket for the initial bug. We'll look at that with priority. Solved in 2023.0.116 but not yet in 2023.1
Want results from more Discord servers?
Add your server