开发者

System.AccessViolationException with Dynamic Proxy Generation

开发者 https://www.devze.com 2022-12-08 17:00 出处:网络
We are using PostSharp to inject caching functionality, we are only seeing this issue when we are using it. When we use Spring the issue seems to go away.

We are using PostSharp to inject caching functionality, we are only seeing this issue when we are using it. When we use Spring the issue seems to go away.

Any help would be appre开发者_开发技巧ciated as this, the issue is very difficult to replicate. I've included the stack trace below:

Attempted to read or write protected memory. 
This is often an indication that other memory is corrupt. 
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 

at System.Diagnostics.SymbolStore.SymWriter.CloseMethod() 
at System.Reflection.Emit.MethodBuilder.CreateMethodBodyHelper(ILGenerator il) 
at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() 
at System.Reflection.Emit.TypeBuilder.CreateType() 
at Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType() 
at Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type[] interfaces, ProxyGenerationOptions options) 
at Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxy(Type theClass, Type[] interfaces, ProxyGenerationOptions options) 
at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type targetType, Type[] interfaces, ProxyGenerationOptions options, Object[] constructorArgs, IInterceptor[] interceptors) 
at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type targetType, Type[] interfaces, IInterceptor[] interceptors) 
at NHibernate.Proxy.Poco.Castle.CastleProxyFactory.GetProxy(Object id, ISessionImplementor session)


I was having similar probelm which I resolved by configuring: Application Pools -> Advanced Setting ->'Enable 32-Bit Applications' to True

Restart IIS and WebSite.


I've seen a similar recurring problem with the project I'm working on, which makes heavy use of Rhino Mocks.

It happens in .NET 3.5 on 64-bit machines when mocking a large number of different interfaces.

The .NET 4.0 beta doesn't seem to have this problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消