具有动态代理生成的 System.AccessViolationException
我们正在使用 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)
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 appreciated 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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了类似的问题,我通过配置解决了:
应用程序池 ->高级设置 ->“启用 32 位应用程序”以真正
重新启动 IIS 和网站。
I was having similar probelm which I resolved by configuring:
Application Pools -> Advanced Setting ->'Enable 32-Bit Applications' to True
Restart IIS and WebSite.
我在我正在从事的项目中看到了类似的反复出现的问题,该项目大量使用了 Rhino Mocks。
在 64 位计算机上的 .NET 3.5 中,当模拟大量不同的接口时,会发生这种情况。
.NET 4.0 beta 似乎没有这个问题。
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.