Random System.AccessViolationException on build server

robi-91's Avatar

robi-91

12 Oct, 2017 09:32 AM

Hi,

we are using Postsharp 4.1.20 and TFS for creating our builds. Right now we are using TFS 2017 and VS 2017 for development. Couple of months ago we started experiencing strange build errors. The error was indicating a System.AccessViolationException. We thought this was because of the build server so we installed a new one. On the new one, we get this error on each build, where as on the old one it was possible to get a successful build, but only after deleting build folders from disk and starting a clean new build. Strange is that the place where error gets thrown is always different.

Please help us to get a stable build. Thank you in advance.

Here is a snippet from our build log indicating the error:
PostSharp30DetectFrameworks:
2017-10-12T08:42:42.0311121Z Target framework is '.NETFramework,Version=v4.5'.
2017-10-12T08:42:42.0311121Z Native framework is '.NETFramework,Version=v4.7'.
2017-10-12T08:42:42.0311121Z PostSharp30:
2017-10-12T08:42:42.0311121Z Creating directory "obj\Release\Before-PostSharp".
2017-10-12T08:42:42.0467010Z Creating directory "obj\Release\PostSharp".
2017-10-12T08:42:42.0467010Z C:\ProgramData\PostSharp\4.1.20\bin.Release\postsharp.4.0-x86.exe obj\Release\Before-PostSharp\WTS.UI.UiCommon.dll /X:default /NoLogo /P:Output=C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\obj\Release\WTS.UI.UiCommon.dll /P:ReferenceDirectory=C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon /P:Configuration=Release /P:Platform=AnyCPU "/P:SearchPath=bin\Release\|obj\Release\|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\ " /P:IntermediateDirectory=obj\Release\PostSharp /P:CleanIntermediate=False /P:MSBuildProjectFullPath=C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj /P:SignAssembly=false /P:PrivateKeyLocation= /P:PrivateKeyContainer= /P:DelaySign= "/P:ResolvedReferences=C:\agent\_work\1\s\packages\DirectShowLib.1.0.0\lib\DirectShowLib.dll|C:\agent\_work\1\s\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll|C:\agent\_work\1\s\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll|C:\agent\_work\1\s\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll|C:\agent\_work\1\s\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll|C:\agent\_work\1\s\packages\NLog.4.4.6\lib\net45\NLog.dll|C:\agent\_work\1\s\Shared\PanelManager\PanelManagerController.dll|C:\agent\_work\1\s\packages\PostSharp.4.1.20\lib\net35-client\PostSharp.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationCore.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\PresentationFramework.dll|C:\agent\_work\1\s\packages\Prism.Core.6.2.0\lib\net45\Prism.dll|C:\agent\_work\1\s\packages\Prism.Mef.6.2.0\lib\net45\Prism.Mef.Wpf.dll|C:\agent\_work\1\s\packages\Prism.Wpf.6.2.0\lib\net45\Prism.Wpf.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.ComponentModel.Composition.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.ComponentModel.DataAnnotations.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Drawing.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Runtime.Serialization.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Windows.Forms.dll|C:\agent\_work\1\s\packages\Prism.Wpf.6.2.0\lib\net45\System.Windows.Interactivity.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xaml.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll|C:\agent\_work\1\s\packages\UI.for.Wpf.45.Xaml.2016.3.1024\lib\net45\Telerik.Windows.Controls.dll|C:\agent\_work\1\s\packages\UI.for.Wpf.45.Xaml.2016.3.1024\lib\net45\Telerik.Windows.Controls.Navigation.dll|C:\agent\_work\1\s\packages\UI.for.Wpf.45.Xaml.2016.3.1024\lib\net45\Telerik.Windows.Data.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsBase.dll|C:\agent\_work\1\s\src\Business\Common.Adaptive.AdaptManager\bin\Release\WTS.Business.Common.Adaptive.AdaptManager.dll|C:\agent\_work\1\s\src\Business\Common.TestResults\bin\Release\WTS.Business.Common.TestResults.dll|C:\agent\_work\1\s\src\Business\Service.ServiceProxy\bin\Release\WTS.Business.Service.ServiceProxy.dll|C:\agent\_work\1\s\src\UI\WTS.UI.UiInfrastructure\bin\Release\WTS.UI.UiInfrastructure.dll|C:\agent\_work\1\s\src\Util\Globals\bin\Release\WTS.Util.Globals.dll|C:\agent\_work\1\s\src\Util\Logging\bin\Release\WTS.Util.Logging.dll|C:\agent\_work\1\s\InternalLib\Security\WTS.Util.Security.dll|C:\agent\_work\1\s\src\Util\TextFormatting\bin\Release\WTS.Util.TextFormatting.dll|C:\agent\_work\1\s\src\Util\Common\bin\Release\WTS.Util.UtilCommon.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Collections.Concurrent.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Collections.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.ComponentModel.Annotations.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.ComponentModel.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.ComponentModel.EventBasedAsync.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Diagnostics.Contracts.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Diagnostics.Debug.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Diagnostics.Tools.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Diagnostics.Tracing.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Dynamic.Runtime.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Globalization.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.IO.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Linq.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Linq.Expressions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Linq.Parallel.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Linq.Queryable.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Net.NetworkInformation.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Net.Primitives.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Net.Requests.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.ObjectModel.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Reflection.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Reflection.Emit.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Reflection.Emit.ILGeneration.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Reflection.Emit.Lightweight.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Reflection.Extensions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Reflection.Primitives.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Resources.ResourceManager.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.Extensions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.InteropServices.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.InteropServices.WindowsRuntime.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.Numerics.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.Serialization.Json.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.Serialization.Primitives.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.Serialization.Xml.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Security.Principal.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.ServiceModel.Duplex.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.ServiceModel.Http.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.ServiceModel.NetTcp.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.ServiceModel.Primitives.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.ServiceModel.Security.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Text.Encoding.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Text.Encoding.Extensions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Text.RegularExpressions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Threading.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Threading.Tasks.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Threading.Tasks.Parallel.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Xml.ReaderWriter.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Xml.XDocument.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Xml.XmlSerializer.dll" /P:SymbolFile=bin\Release\WTS.UI.UiCommon.pssym /P:WriteWeavingSymbols=True /P:ConstraintVerificationEnabled=True /P:RuntimeVerificationEnabled=False /P:TargetFrameworkVersion=v4.5 /P:TargetFrameworkIdentifier=.NETFramework /P:TargetFrameworkProfile= "/P:TargetFrameworkMoniker=.NETFramework,v4.5" "/P:NativeFrameworkMoniker=.NETFramework,v4.7" /P:InstalledFrameworksFilePath=C:\ProgramData\PostSharp\InstalledFrameworks\1f251feeb5084ccae291df3e0745f7cb.xml /P:ProgramDataDirectory=C:\ProgramData\PostSharp /P:AspectProviders= "/P:Language=C#" /config C:\ProgramData\PostSharp\4.1.20\bin.Release\postsharp.srv.4.0-x86.exe.config
2017-10-12T08:42:42.9060733Z
2017-10-12T08:42:42.9060733Z Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
2017-10-12T08:42:42.9060733Z at ^xavCxxs3IFFM.^B7ab(Byte* _0, Int32 _1, Byte*& _2, UInt32& _3)
2017-10-12T08:42:42.9060733Z at ^xavCxxs3IFFM.^V7z6Q7xx(Int32 _0)
2017-10-12T08:42:42.9060733Z at ^0RC0kpHqS6Uy.^HJKTZ5p+(^EyL1LQX01Ck8 _0)
2017-10-12T08:42:42.9060733Z at ^0RC0kpHqS6Uy.^+uOpswsK(^EyL1LQX01Ck8 _0, BufferReader& _1)
2017-10-12T08:42:42.9060733Z at ^0RC0kpHqS6Uy.^LW0c4duQ(^EyL1LQX01Ck8 _0)
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.Binary.ModuleReader.ImportAssemblyRef(Int32 _0)
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.Binary.ModuleReader.ImportAssemblyRefs()
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.CodeModel.Collections.AssemblyRefDeclarationCollection.DoLazyLoading()
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.CodeModel.Collections.ElementCollection`1.^7qsXyJec()
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.CodeModel.Collections.ElementCollection`1.GetEnumerator()
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.CodeModel.ModuleDeclaration.FindAssembly(IAssemblyName assemblyName, BindingOptions bindingOptions)
2017-10-12T08:42:42.9060733Z at ^XJbqCOExOmCj.^COARuyiS(TypeDefDeclaration _0, ModuleDeclaration _1, BindingOptions _2)
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.CodeModel.TypeDefDeclaration.Translate(ModuleDeclaration targetModule)
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.CodeModel.TypeRefDeclaration.Translate(ModuleDeclaration targetModule)
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.CodeModel.TypeRefDeclaration.^gq20Za8my5ww(ModuleDeclaration _0)
2017-10-12T08:42:42.9060733Z at ^jqeKuXFvja9f.Execute()
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
2017-10-12T08:42:42.9060733Z at PostSharp.Sdk.Extensibility.Project.Execute()
2017-10-12T08:42:42.9060733Z at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
2017-10-12T08:42:42.9060733Z at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)
2017-10-12T08:42:42.9060733Z at PostSharp.Hosting.Program.ExecuteImpl()
2017-10-12T08:42:42.9060733Z at PostSharp.Hosting.Program.Execute()
2017-10-12T08:42:42.9060733Z at PostSharp.Hosting.PostSharpDomainManager.Start(Boolean server)
2017-10-12T08:42:43.3122780Z ##[error]packages\PostSharp.4.1.20\tools\PostSharp.targets(315,5): Error MSB6006: "postsharp.4.0-x86.exe" exited with code 255.
2017-10-12T08:42:43.3122780Z C:\agent\_work\1\s\packages\PostSharp.4.1.20\tools\PostSharp.targets(315,5): error MSB6006: "postsharp.4.0-x86.exe" exited with code 255. [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]

  1. Support Staff 1 Posted by PostSharp Techn... on 12 Oct, 2017 12:08 PM

    PostSharp Technologies's Avatar

    Hello,

    unfortunately, PostSharp 4.1 is no longer supported. It seems like you have ran into a compatibility issue. Have you tried to upgrade PostSharp to one of the supported versions? (4.3 or 5.0).

    Best regards,
    -tony

  2. 2 Posted by robi-91 on 16 Oct, 2017 02:36 PM

    robi-91's Avatar

    Hello,

    upgrading to 4.3 did not fix the problem. I get the same error...

    (PostSharp30Core target) ->
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.Buffers.BufferUtilities.RtlMoveMemory(Byte* target, Byte* source, Int32 count) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.Buffers.BufferUtilities.CopyMemory(Byte* source, Byte* target, Int32 count) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.Buffers.BufferUtilities.CopyMemory(Byte* source, Byte[] target) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.Buffers.BufferReader.ToByteArray() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at ^0RC0kpHqS6Uy.^LW0c4duQ(^EyL1LQX01Ck8 _0) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.Binary.ModuleReader.ImportAssemblyRef(Int32 _0) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.Binary.ModuleReader.ImportAssemblyRefs() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.CodeModel.Collections.AssemblyRefDeclarationCollection.DoLazyLoading() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.CodeModel.Collections.ElementCollection`1.^7qsXyJec() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.CodeModel.Collections.ElementCollection`1.GetEnumerator() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.CodeModel.ModuleDeclaration.FindAssembly(IAssemblyName assemblyName, BindingOptions bindingOptions) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at ^XJbqCOExOmCj.^COARuyiS(TypeDefDeclaration _0, ModuleDeclaration _1, BindingOptions _2) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.CodeModel.TypeDefDeclaration.Translate(ModuleDeclaration targetModule) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.CodeModel.TypeRefDeclaration.Translate(ModuleDeclaration targetModule) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.CodeModel.TypeRefDeclaration.^gq20Za8my5ww(ModuleDeclaration _0) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at ^jqeKuXFvja9f.Execute() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Sdk.Extensibility.Project.Execute() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Hosting.PostSharpObject.ExecuteProjects() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Hosting.Program.ExecuteImpl() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Hosting.Program.Execute() [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : at PostSharp.Hosting.PostSharpDomainManager.Start(Boolean server) [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z C:\agent\_work\1\s\packages\PostSharp.4.3.38\tools\PostSharp.targets(322,5): error : The process C:\ProgramData\PostSharp\4.3.38\bin.Release\postsharp-net40-x86-native.exe exited with code 255. [C:\agent\_work\1\s\src\UI\WTS.UI.UiCommon\UiCommon.csproj]
    2017-10-16T13:55:35.2618501Z
    2017-10-16T13:55:35.2618501Z 135 Warning(s)
    2017-10-16T13:55:35.2618501Z 26 Error(s)

  3. Support Staff 3 Posted by PostSharp Techn... on 18 Oct, 2017 01:31 PM

    PostSharp Technologies's Avatar

    Hello,

    According to both reported stack traces the exception is thrown when PostSharp tries to read the table of the referenced assemblies in the assembly being processed. It is possible that we do not handle correctly some special case of the executable file format or maybe the file is rendered invalid by some other tool on the build server.

    To debug the issue we would need to reproduce it locally and it looks like we need to replicate the environment of your build server. Could you please provide us more information about the setup of your build server - the OS, VisualStudio and .NET versions, other build tools installed etc.? Can you find any significant differences between the dev and build server environment? Do you use any additional tools on the build server, such as obfuscator, FxCop, antivirus etc.?

    Please also try to use the latest version of PostSharp 5.0, version 4.3 does not support Visual Studio 2017.

    -alex

  4. 4 Posted by robi-91 on 18 Oct, 2017 02:21 PM

    robi-91's Avatar

    Hi,

    the build server is running with Windows 8.1 and only Visual Studio Professional 2017 (version 15.0.0+26228.16) is installed. .NET version 3.5.1 and 4.7 are installed. There is no significant difference between build and developer except that the build machine is a new computer with only VS 2017 installed, whereas most developer have or had at least VS 2015 installed. We use .net reactor for obfuscating some dlls.

    We tried updating to version 4.3 and unfortunately the same problem occurs again. Update to postsharp 5.0 is difficult and would require more effort because postsharp 5.0 reimplements some parts. Therefore, before updating to 5.0 and making the effort, we would like to ensure what the problem is and that the problem will really be resolved by it.

    PS. we have another build machine where this error comes only occasionally. This other system has additionally VS 2015 installed with VS 2017. There we experience this problem randomly (but often) and the problem seems to go away after deleting build folder. Maybe this information helps you somehow?

    robert

  5. 5 Posted by robi-91 on 19 Oct, 2017 07:54 AM

    robi-91's Avatar

    Hi,

    unfortunately this problem is now always occurring on both of our build servers! We are desperate and we need a solution fast. Otherwise we are left without a working build. Is it possible to speed up the error analysis?

    We are a regular Postsharp customer with included Support Case. Will it help to activate such a Support case so we can get more directly into contact?

    robert

  6. Support Staff 6 Posted by PostSharp Techn... on 19 Oct, 2017 09:10 AM

    PostSharp Technologies's Avatar

    Hello,

    We suspect that the issue is caused by incompatibility between PostSharp and .NET Reactor. This may also be caused by obfuscator on purpose to prevent tempering with the protected assembly. To test this theory you can temporary disable all obfuscation on your build servers.

    The solution to this issue would be to ensure that the obfuscator always runs after PostSharp. If the obfuscator is integrated via .csproj file then make sure that the <Include/> line for the obfuscator is locater after the <Include/> line for PostSharp in the .csproj file.

    We can also debug the issue in our environment if you could provide us with the obfuscated assembly.

    -alex

  7. 7 Posted by robi-91 on 20 Oct, 2017 06:37 AM

    robi-91's Avatar

    Hi,

    yes, that was the problem! Upon removing .Net Reactor, the build stabilized!

    Here is an obfuscated dll for debugging. As we have many solutions with many projects, it's unfortunately not that easy to run obfuscation after Postsharp.

    robert

  8. 8 Posted by robi-91 on 20 Oct, 2017 06:38 AM

    robi-91's Avatar

    Sorry, forgot to attach the obfuscated dll...

  9. Support Staff 9 Posted by PostSharp Techn... on 21 Oct, 2017 03:54 PM

    PostSharp Technologies's Avatar

    Hello,

    Thank you for sharing the assembly with us. We were able to reproduce the exception in the debug environment. Indeed, the modifications performed by .NET Reactor cause PostSharp to fail when loading the assembly. Also, trying to open the assembly with ILDASM results in the error message "Protected module -- cannot disassemble". Which is of course expected when the assembly has been processed by obfuscator.

    Please note that PostSharp is only guaranteed to work on assemblies that were produced by C# or VisualBasic compilers. The output of obfuscators is by design difficult to tamper with. This is why it's important to ensure that PostSharp executes before .NET Reactor in the build process. However, you should not be required to enforce this rule globally - to build all your solutions first and then execute obfuscator. I expect that it should be enough to enforce the rule on the per-project basis. Whenever you build a single project, PostSharp must execute before .NET Reactor.

    We can help you to change the build setup if you share with us how .NET Reactor is integrated into your build process. Usually this is done by adding <Include/> element in .csproj file. You may also want to contact .NET Reactor support for suggestions.

    -alex

  10. Support Staff 10 Posted by PostSharp Techn... on 06 Nov, 2017 02:36 PM

    PostSharp Technologies's Avatar

    Hello,

    We are going to close this request as there have not been any further updates. Please feel free to reopen the discussion if you need more help.

    Thanks,
    PostSharp Team

  11. PostSharp Technologies closed this discussion on 06 Nov, 2017 02:36 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac