Postsharp Error after updating newtonsoft

439 Views Asked by At

I have a .net framework solution, that uses postsharp version 4.2.21.0.

I have a demand to upgrade our newtonsoft.json package from 11.0.2 to 13.0.1. After this upgrade, solution became unable to build, because os this post sharp error

Severity    Code    Description Project File    Line    Suppression State
Error       Unhandled exception (4.2.21.0, postsharp-net40-x86-srv.exe, CLR 4.0.30319.528449, Release):
System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at ^e9p3FN6izlJE.^TxMhIJ+U(^EyL1LQX01Ck8 _0)
  at PostSharp.Sdk.Binary.ModuleReader.ImportCustomAttributes()
  at PostSharp.Sdk.Binary.ModuleReader.ImportCustomAttributes(MetadataDeclaration _0)
  at PostSharp.Sdk.CodeModel.Collections.CustomAttributeDeclarationCollection.DoLazyLoading()
  at PostSharp.Sdk.CodeModel.Collections.ElementCollection`1.^7qsXyJec()
  at PostSharp.Sdk.CodeModel.Collections.ElementCollection`1.GetEnumerator()
  at PostSharp.Sdk.Extensibility.Tasks.AnnotationRepositoryTask.^H9TZo5Th(TypeDefDeclaration _0)
  at PostSharp.Sdk.Extensibility.Tasks.AnnotationRepositoryTask.^wwGmHrz+(IAnnotationInstance _0)
  at PostSharp.Sdk.Extensibility.Tasks.AnnotationRepositoryTask.Execute()
  at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
  at PostSharp.Sdk.Extensibility.Project.Execute()
  at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
  at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation).

When I downgrade newtonsoft.json back to 11.0.2, solution builds fine.

Is it possible to update this newtonsoft.json withou geting the postsharp error?

1

There are 1 best solutions below

0
Gael Fraiteur On

This is certainly a bug in PostSharp 4.2, released in 2015, but it is currently unsupported. Please update to a supported version.