Error After Upgrading to 6.0.27

robert.ranck's Avatar


03 Oct, 2018 07:44 PM

After upgrading to PostSharp 6, I am getting the following error when I try to do a build.
Unhandled exception (postsharp-x86-srv.exe 6.0.27 release | .NET Framework 4.7.2): System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at ^xyTKRkLQfZ4O.^BCT2.^1+qScw3z(MetadataToken _0) in ^2+Cr1QZ63nRt:line 183
   at ^xyTKRkLQfZ4O.^1+qScw3z(MetadataToken _0) in ^2+Cr1QZ63nRt:line 109
   at ^WcPFY\.RUh6oq.CloseMethod() in ^zuISHPhx1R7/:line 171
   at ^zpGNRK5nUM9z.^DiP+8LBm(BufferWriter _0, Int32[] _1, Int32 _2) in ^dzcuHqui:line 395
   at ^zpGNRK5nUM9z.^SkiT(BufferWriter _0) in ^dzcuHqui:line 110
   at PostSharp.Sdk.Binary.ModuleWriter.WriteMethodBody(BufferWriter _0, MethodDefDeclaration _1, UInt32 _2, Int32 _3, Int32 _4) in ^tezRMreC:line 1532
   at PostSharp.Sdk.Binary.ModuleWriter.WriteMethodBodies(BufferWriter _0, UInt32 _1) in ^tezRMreC:line 1505
   at ^XLVeHKzJ.^VfvrABjR() in ^62cDaY2Q:line 488
   at ^XLVeHKzJ.^SkiT() in ^62cDaY2Q:line 138
   at ^XLVeHKzJ.^8KD6D2SV(String _0) in ^62cDaY2Q:line 163
   at ^cyC/TYSlPGB/.^wvPm(^t9VuvqVboKU4 _0, ^RtksFin57NJ8 _1, ^8gP93Xsl\+Imn _2) in ^VLQPDfv+wmUE:line 24
   at PostSharp.Sdk.Extensibility.Tasks.CompileTask.Execute() in ^Fy2zcVesSTyC:line 341
   at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase) in ^hW2eIAWj:line 2332
   at PostSharp.Sdk.Extensibility.Project.Execute() in ^hW2eIAWj:line 2399
   at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation) in D:\src\PostSharp-5\Core\PostSharp.Hosting\PostSharpObject.cs:line 283. Framework.Api

  1. Support Staff 1 Posted by PostSharp Techn... on 04 Oct, 2018 10:30 AM

    PostSharp Technologies's Avatar


    thank you for reporting this error. To figure out the cause of this error, we'd need some more information from you. Could you please provide the following?

    1) Detailed log including tracing of involved PostSharp components. You can obtain the log using the following command executed in Developer Command Prompt for Visual Studio in the directory where your .csproj file is located:

    msbuild /t:Rebuild /p:PostSharpTrace="DebugReader;DebugWriter;CodeWeaver;InstructionReader;InstructionWriter;ModuleReader;ModuleWriter;AspectInfrastructure;AspectWeaver" /v:d > build.log

    2) Content of directories obj\PostSharp and obj\Before-PostSharp. These directories contain input data for PostSharp, which would help us to reproduce your issue.

    Best regards,

  2. 2 Posted by robert.ranck on 04 Oct, 2018 03:33 PM

    robert.ranck's Avatar

    I have attached the requested files.

  3. Support Staff 3 Posted by PostSharp Techn... on 09 Oct, 2018 09:12 AM

    PostSharp Technologies's Avatar


    I was unable to find the cause for this problem in the assembly itself. Would it be possible to share following dependencies?

    EX.Cryptography.dll FormFlow.Engine.dll Jenzabar.Providers.Contracts.dll

    Additionally Framework.Api.csproj file would also help us a lot.


    All the best,

  4. 4 Posted by robert.ranck on 10 Oct, 2018 06:49 PM

    robert.ranck's Avatar

    I have attached the requested files.

  5. Support Staff 5 Posted by PostSharp Techn... on 11 Oct, 2018 02:30 PM

    PostSharp Technologies's Avatar


    it does not seem like like a bug in PostSharp per se - the PDB is actually incorrect or does not match the input assembly, most likely caused by CodeContracts. PostSharp 4.3 is most likely ignoring this part of PDB or is not transforming it.

    That said, PostSharp should not crash on invalid PDB - I have fixed this (and have the transformation of your DLL pass without errors), but I'm not sure if CodeContracts actually works properly in your case. Fix would be most likely included with the next version (~2 weeks from now).

    I don't think there is a workaround at this moment. The only possibility is to disable PDB completely.

    (internal #20764)


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? 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