Closed WhitWaldo closed 10 months ago
Hello @WhitWaldo, thank you for submitting this issue. We will try to get back to you as soon as possible. Note to the PostSharp team, this ticket is being tracked in our dashboard under ID TP-33617.
There should be a crash report with full exception information in %TEMP%\Metalama\CrashReports
. Can you check and post it here? Thanks.
Deleted all the crash reports in there so I could spot the new one get created and so it did:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.IOException: The process cannot access the file 'C:\Users\
\AppData\Local\Temp\Metalama\Extract\2023.3.1.0-3a3c6138\K4os.Hash.xxHash.dll' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at Metalama.Framework.CompilerExtensions.ResourceExtractor.ExtractEmbeddedAssemblies(Assembly currentAssembly) at Metalama.Framework.CompilerExtensions.ResourceExtractor.Initialize() at Metalama.Framework.CompilerExtensions.ResourceExtractor.CreateInstance(String assemblyName, String typeName) at Metalama.Framework.CompilerExtensions.MetalamaSourceTransformer..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions 1.GetAnalyzersForTypeNames(Assembly analyzerAssembly, IEnumerable
1 analyzerTypeNames, Boolean& reportedError) in C:\buildAgent\work\62cb8f15a7eb0a2e\src\Compilers\Core\Portable\DiagnosticAnalyzer\AnalyzerFileReference.cs:line 677
Just updated the underlying project to use the latest Metalama preview and updated the package in this project. It's building again so that appears to have fixed it for now.
I'll leave it to you whether you want to close the ticket as something you want to solve or not on your side, but I'm no longer blocked.
This looks like an intermittent problem, deleting the Extract
directory or upgrading are workarounds, but we're going to have to fix this properly, so I'm leaving this open.
Perhaps it's just that I've had two instances of VS open for too long (since I originally filed this report), but just experienced the problem again.
If there are any extract-{guid}.log
files in the directory mentioned in the exception, can you share them here? Also, can you think of a reason why writing to that directory might fail on your machine, like a full disk?
No logs specifically mentioned in the exception (nor in the log file above - only pulled that one by deleting all the logs in there and attempting another build, producing it). Looking at the directory, it doesn't look like any CrashReports were produced either as there's only the one exception I included earlier in this issue.
I closed all my VS instances and restarted them and the error went away again. With regards to disk space, I've got several drives connected to this computer and the lowest remaining capacity is just under 70 GB, so I don't think that's it. Rather, the exception above seems to suggest that perhaps multiple instances of VS open at a time is the culprit when I kick off a build in each one and they're each using the same file and not releasing quickly enough.
I did recently have a pretty disk-heavy build pipeline to generate CSS files on a per-file basis so perhaps between the longer-than-normal build times there that had something to do with it, but I did improve on that yesterday (hadn't restarted VS since that check-in) so maybe it was somehow related.
Looking at the directory, it doesn't look like any CrashReports were produced either as there's only the one exception I included earlier in this issue.
Maybe I wasn't clear, I meant the C:\Users\<me>\AppData\Local\Temp\Metalama\Extract\2023.3.1.0-3a3c6138
directory.
the exception above seems to suggest that perhaps multiple instances of VS open at a time is the culprit when I kick off a build in each one and they're each using the same file and not releasing quickly enough.
That shouldn't be happening. We have a global mutex guarding writing to that directory.
I since updated to 2023.3.2 and saw this again (restarting my computer resolved it). Here's the content of the log requested (cleaned up some to remove my identifiers):
Extracting resources... Process Name: devenv Process Id: 3412 Process Kind: DevEnv Command Line: "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe" "I:\MyProject.sln" Source Assembly Name: 'Metalama.Framework.CompilerExtensions, Version=2023.3.2.0, Culture=neutral, PublicKeyToken=772fca7b1db8db06' Source Assembly Location: 'C:\Users\whit_\AppData\Local\Temp\VS\AnalyzerAssemblyLoader\df4ad440f585489b9fd16e1d30ea1fb8\24\Metalama.Framework.CompilerExtensions.dll' Mutex name: 'Global\Metalama_Extract_2023.3.2.0-2227f91c'
Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Microsoft.Bcl.HashCode.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Microsoft.Bcl.HashCode.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.K4os.Hash.xxHash.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\K4os.Hash.xxHash.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Newtonsoft.Json.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Newtonsoft.Json.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.DiffPlex.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\DiffPlex.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Microsoft.VisualStudio.Threading.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Microsoft.VisualStudio.Threading.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Microsoft.VisualStudio.Validation.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Microsoft.VisualStudio.Validation.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Backstage.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Backstage.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Compiler.Interface.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Compiler.Interface.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.CompileTimeContracts.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.CompileTimeContracts.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.DesignTime.4.0.1.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.DesignTime.4.0.1.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.DesignTime.4.4.0.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.DesignTime.4.4.0.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.DesignTime.Contracts.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.DesignTime.Contracts.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.DesignTime.Rpc.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.DesignTime.Rpc.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.DesignTime.VisualStudio.4.0.1.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.DesignTime.VisualStudio.4.0.1.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.DesignTime.VisualStudio.4.4.0.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.DesignTime.VisualStudio.4.4.0.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.Engine.4.0.1.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.Engine.4.0.1.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.Engine.4.4.0.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.Engine.4.4.0.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.Introspection.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.Introspection.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.Framework.Sdk.dll' to 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.Framework.Sdk.dll'. Extracting resource 'Metalama.Framework.CompilerExtensions.Resources.Metalama.SystemTypes.dll' to 'C:\Users\whit_\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\Metalama.SystemTypes.dll'.
Still experiencing this, but in a different project this time and it's blocking the build of the aspect. I've got 9 instances of VS open all pointed at different projects and it's getting increasingly impractical to close them all just to restart to eliminate this error.
Metalama Version: 2023.3.2.0 Runtime: .NET Framework 4.8.9167.0 Processor Architecture: X64 OS Description: Microsoft Windows 10.0.19045 OS Architecture: X64 Process Name: VBCSCompiler Process Id: 96952 Process Kind: Compiler Command Line: "C:\Users\whit_.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\VBCSCompiler.exe" "-pipename:xjsNQJ6mwVtCJkKNbYuAADRoZGLKB595e0DvjVPuCM" Exception type: System.IO.IOException Exception message: The process cannot access the file 'C:\Users\whit\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\K4os.Hash.xxHash.dll' because it is being used by another process. ===== Exception ===== System.IO.IOException: The process cannot access the file 'C:\Users\whit_\AppData\Local\Temp\Metalama\Extract\2023.3.2.0-2227f91c\K4os.Hash.xxHash.dll' because it is being used by another process. at System.IO.Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITYATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at Metalama.Framework.CompilerExtensions.ResourceExtractor.ExtractEmbeddedAssemblies(Assembly currentAssembly) at Metalama.Framework.CompilerExtensions.ResourceExtractor.Initialize() at Metalama.Framework.CompilerExtensions.ResourceExtractor.CreateInstance(String assemblyName, String typeName) ===== Loaded assemblies ===== C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\VBCSCompiler.exe C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0b77a5c561934e089\System.dll C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Configuration.dll C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0b77a5c561934e089\System.Core.dll C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0b77a5c561934e089\System.Xml.dll C:\Users\whit_.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\Microsoft.CodeAnalysis.dll C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\netstandard\v4.0_2.0.0.0cc7b13ffcd2ddd51\netstandard.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\System.Collections.Immutable.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\System.ValueTuple.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\System.Threading.Tasks.Extensions.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\System.Runtime.CompilerServices.Unsafe.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\System.Reflection.Metadata.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\Microsoft.CodeAnalysis.CSharp.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\Microsoft.CodeAnalysis.VisualBasic.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\Metalama.Compiler.Interface.dll C:\Users\whit.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\System.Memory.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\1\Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\2\Microsoft.CodeAnalysis.NetAnalyzers.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\3\Metalama.Framework.CompilerExtensions.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\4\Metalama.Framework.EditorExtensions.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\5\Microsoft.Interop.JavaScript.JSImportGenerator.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\6\Microsoft.Interop.LibraryImportGenerator.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\7\Microsoft.Interop.SourceGeneration.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\8\System.Text.Json.SourceGeneration.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\9\System.Text.RegularExpressions.Generator.dll C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Globalization\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Globalization.dll C:\Users\whit_.nuget\packages\metalama.compiler\2023.3.2-preview\tasks\net472\System.Numerics.Vectors.dll C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.InteropServices.RuntimeInformation\v4.0_4.0.0.0b03f5f7f11d50a3a\System.Runtime.InteropServices.RuntimeInformation.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\10\Microsoft.AspNetCore.App.Analyzers.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\11\Microsoft.AspNetCore.App.CodeFixes.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\12\Microsoft.AspNetCore.Components.Analyzers.dll C:\Users\whit\AppData\Local\Temp\VBCSCompiler\AnalyzerAssemblyLoader\342f670e7c0043f59de90694b365eae0\13\Microsoft.Extensions.Logging.Generators.dll ===== Log =====
Solved in 2023.3.3-preview.
I'm working on a Blazor Server project. It's been building fine for days without issue, including throughout the last day. I added a few more pieces to it and tried to test it and out of nowhere, I'm getting a Metalama exception that's blocking the build:
I don't see that there are any other crash reports or the like created alongside it. I don't directly import Metalama.Framework in this project and only use it via a NuGet package that implements a logging aspect I developed (itself running 2023.3.1-preview). This package hasn't seen an update in 2 days and I last successfully built this about four hours ago.
A restart of Visual Studio did nothing to resolve the issue. What could have suddenly changed that's breaking this in a project that doesn't directly reference Metalama?
Thanks!