PostSharp5 icon indicating copy to clipboard operation
PostSharp5 copied to clipboard

The caching example throws an exception

Open ajaymahale opened this issue 13 years ago • 1 comments

Download the code, opened in visual studio and ran the caching example, which throws a wierd exception

System.TypeInitializationException was unhandled Message=The type initializer for 'Caching.BlueBookService' threw an exception. Source=Caching TypeName=Caching.BlueBookService StackTrace: at Caching.BlueBookService..ctor() at Caching.CarDealership..ctor() in C:\Users\ajay.m\Downloads\mgroves-PostSharp5-8d17b2f\mgroves-PostSharp5-8d17b2f\4-Caching\CarDealership.cs:line 11 at Caching.Program.Main() in C:\Users\ajay.m\Downloads\mgroves-PostSharp5-8d17b2f\mgroves-PostSharp5-8d17b2f\4-Caching\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.TypeInitializationException Message=The type initializer for '<>z__Aspects' threw an exception. Source=Caching TypeName=<>z__Aspects StackTrace: at Caching.BlueBookService.<>z__Aspects.Initialize() at Caching.BlueBookService..cctor() in :line 0 InnerException: System.TypeInitializationException Message=The type initializer for '<>z__AspectsImplementationDetails1721805061' threw an exception. Source=Caching TypeName=<>z__AspectsImplementationDetails1721805061 StackTrace: at Caching.BlueBookService.<>z__Aspects..cctor() in :line 0 InnerException: System.MissingMethodException Message=Method not found: 'PostSharp.Aspects.IAspect[] PostSharp.Aspects.Serialization.AspectSerializer.Deserialize(System.Reflection.Assembly, System.String, PostSharp.Reflection.IMetadataDispenser)'. Source=Caching StackTrace: at <>z__AspectsImplementationDetails1721805061..cctor() InnerException:

ajaymahale avatar Jul 27 '12 10:07 ajaymahale

The problem is that the DLL I have in this github repo is from PostSharp 2.0, but you probably have PostSharp 2.1 installed.

The workaround would be to copy a PostSharp.dll file and update your references. Long term, I need to update this repo to use NuGet instead (I started writing this code before PostSharp was on NuGet).

mgroves avatar Jul 28 '12 20:07 mgroves