3

I'm using the latest version of PostSharp (version 4.1.31.0) in a C# solution with Visual Studio 2015 (with update 1).

Everytime I try to build the solution I get the following error:

Unhandled exception (4.1.31.0, postsharp.srv.4.0-x86.exe, CLR 4.0.30319.394271, Release): System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

I've switched on detailed output when building but haven't been able to spot anything in the output so far!

I have other solutions that work fine with this version so I suspect it is something to do with the solution's configuration.

As an aside, I have also tried version 4.1.30 and get exactly the same error.

Any help or advice on where to look would be greatly appreciated.

Ben Thomson
  • 1,083
  • 13
  • 29

2 Answers2

3

So to solve my issue all I had to do was to set the PostSharp 'Processor Architecture' option in the project properties to x64 for the project that includes my aspects.

PostSharp architecture settings

I'm not exactly sure why but my application builds and runs without issues.

Ben Thomson
  • 1,083
  • 13
  • 29
  • It would be interesting for us to know what transformations you are using. Running out of memory on x86 process is something that would happen only for extremely large assemblies. We would really appreciate if you could contact us on our support forum and provide us with details about your project. Thanks! – Daniel Balas Dec 07 '15 at 16:17
  • Hi Daniel, I will get all the details together for you tomorrow and post in your forum. what kind of information do you need? I think switching to x64 is hiding a wider issue with the solution as the PostSharp compiler service memory goes to over 4,500mb. – Ben Thomson Dec 07 '15 at 18:43
0

Had the same issue, PostSharp crashing at compile time:

Severity    Code    Description Project File    Line    Suppression State
Error       An unexpected exception occurred when executing user code: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   at System.Reflection.RuntimeMethodInfo.GetParameters()
   at PostSharp.Patterns.Model.NotifyPropertyChanged.DependencyAnalysis.InpcMemberAnalysis.IsInpcIgnoredProperty(PropertyInfo property)
   at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.<>c.<GetNotifiableProperties>b__48_0(PropertyInfo p)
   at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
   at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.GetNotifiableProperties(Type type, Boolean excludeExplicitProperties, Boolean& hasExplicitProperties)
   at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.CompileTimeInitialize(Type type, AspectInfo aspectInfo)
   at PostSharp.Sdk.AspectWeaver.AspectWeavers.TypeLevelAspectWeaverInstance.^gAHJKdyo.^WnalpwzH()
   at PostSharp.Sdk.Utilities.ExceptionHelper.ExecuteUserCode(MessageLocation messageLocation, Action userCode, Type[] acceptableExceptions).   Avalon.Dock.Measurements            

Solved it by killing the process PostSharp Compile service (something like this) from the task manager.

Damien
  • 1,492
  • 10
  • 32