ArxOne / MrAdvice

.NET aspect weaver (build task under NuGet package)
MIT License
308 stars 45 forks source link

Crash when weaving in azure linux build agent .net 6 #184

Closed jorgenbosman closed 2 years ago

jorgenbosman commented 2 years ago

MrAdvice 2.9.7/.NET 6.0 weaved module 'Fluvius.M2.ProcessFramework.Receiver, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' (targeting framework .NET 6.0) in 544ms Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at dnlib.IO.UnalignedNativeMemoryDataStream.ReadUInt32(UInt32) at dnlib.W32Resources.ResourceDirectoryPE.Initialize(dnlib.IO.DataReader ByRef) at dnlib.W32Resources.ResourceDirectoryPE..ctor(UInt32, dnlib.W32Resources.ResourceName, dnlib.W32Resources.Win32ResourcesPE, dnlib.IO.DataReader ByRef) at dnlib.W32Resources.Win32ResourcesPE.b__18_0() at dnlib.Utils.UserValue1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].get_Value() at dnlib.W32Resources.Win32ResourcesPE.get_Root() at dnlib.DotNet.Writer.Win32ResourcesChunk.SetOffset(dnlib.IO.FileOffset, dnlib.PE.RVA) at dnlib.DotNet.Writer.ChunkListBase1[[System.Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetOffset(dnlib.IO.FileOffset, dnlib.PE.RVA) at dnlib.DotNet.Writer.ModuleWriterBase.CalculateRvasAndFileOffsets(System.Collections.Generic.List1<dnlib.DotNet.Writer.IChunk>, dnlib.IO.FileOffset, dnlib.PE.RVA, UInt32, UInt32) at dnlib.DotNet.Writer.ModuleWriter.WriteFile() at dnlib.DotNet.Writer.ModuleWriter.WriteImpl() at dnlib.DotNet.Writer.ModuleWriterBase.Write(System.IO.Stream) at dnlib.DotNet.Writer.ModuleWriterBase.Write(System.String) at dnlib.DotNet.ModuleDef.Write(System.String, dnlib.DotNet.Writer.ModuleWriterOptions) at StitcherBoy.Reflection.ModuleManager.WriteModule(dnlib.DotNet.Writer.ModuleWriterOptionsBase) at StitcherBoy.Reflection.ModuleManager.Write(System.String) at StitcherBoy.Weaving.Build.AssemblyStitcher.Process(System.Collections.Generic.IDictionary2<System.String,System.String>, System.String) at StitcherBoy.Stitcher.Run[[System.Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.String[]) at Program.

$(System.String[]) Aborted (core dumped) /home/vsts/.nuget/packages/mradvice/2.9.7/build/MrAdvice.targets(15,5): error MSB3073: The command "dotnet "/home/vsts/.nuget/packages/mradvice/2.9.7/build/../tools/net6.0/MrAdvice.Weaver.dll" AssemblyPath="obj/Release/net6.0/Fluvius.M2.ProcessFramework.Receiver.dll" ReferencePath="@obj/Release/net6.0/Fluvius.M2.ProcessFramework.Receiver.dll.MrAdvice.ReferencePath.txt" ReferenceCopyLocalPaths="@obj/Release/net6.0/Fluvius.M2.ProcessFramework.Receiver.dll.MrAdvice.LocalReferencePath.txt" AssemblyOriginatorKeyFile="" SignAssembly="false"" exited with code 134. [/home/vsts/work/1/s/Sources/MEEP/Fluvius.M2/Fluvius.M2.ProcessFramework/Fluvius.M2.ProcessFramework.Receiver/Fluvius.M2.ProcessFramework.Receiver.csproj]

picrap commented 2 years ago

What is specific with this environment? (since it crashes in dnlib, which I didn’t write, all we can do is try to understand what causes the error and try a workaround)

jorgenbosman commented 2 years ago

Not sure, it's linux, it's azure... when I build the same solution locally on windows, it works fine. When the same project witin that solution is built on that agent, it also builds normally. Perhaps the agent has not enough memory or something to build the large solution...

jorgenbosman commented 2 years ago

Issue was due to the fact that the same project was being built twice at the same time

picrap commented 2 years ago

Easier for me to fix :) Thank you