动态代理生成的System.AccessViolationException

时间:2009-10-19 09:24:50

标签: c# aop postsharp access-violation

我们正在使用PostSharp来注入缓存功能,我们只是在使用它时才会看到这个问题。当我们使用Spring时,问题似乎就消失了。

任何帮助都会受到赞赏,因为这个问题很难复制。我在下面列出了堆栈跟踪:

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)

2 个答案:

答案 0 :(得分:2)

我有类似的问题,我通过配置解决了: 应用程序池 - >高级设置 - >'启用32位应用程序'为真

重新启动IIS和网站。

答案 1 :(得分:1)

我已经看到了与我正在进行的项目类似的反复出现的问题,这大量使用了Rhino Mocks。

当模拟大量不同的接口时,它发生在64位计算机上的.NET 3.5中。

.NET 4.0 beta似乎没有这个问题。

相关问题