2009-10-19 68 views
1

我們使用PostSharp來注入緩存功能,我們在使用它時只會看到這個問題。當我們使用Spring時,問題似乎消失了。帶動態代理生成的System.AccessViolationException

任何幫助將不勝感激,因爲這個問題很難複製。我已經包括下面的堆棧跟蹤:

 
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) 
+0

類似:http://issues.castleproject.org/issue/DYNPROXY-129 – 2012-10-03 06:17:03

+0

類似:https://groups.google.com/forum/?fromgroups#!topic/rhinomocks/WaapfXGTh-E – 2012-10-03 06:17:28

回答

1

我已經看到了我工作的項目,這使得大量使用犀牛製品的類似的反覆出現的問題。

它發生在.NET 3.5中的64位機器上時,嘲笑大量不同的接口。

.NET 4.0 beta似乎沒有這個問題。

+0

有一個原因被發現這個問題? – 2012-10-03 06:10:58

+0

在我們的例子中,我們只編輯了我們的構建腳本以分別運行我們單獨的測試程序集,以減少每次測試運行時動態實例化的類型的數量,從而降低了問題發生的可能性。然後,我們稍後升級到.NET 4.0,它似乎完全解決了這個問題。 我的猜測是這可能是MS反射方法中的非託管代碼中的一些錯誤。 – 2013-03-14 20:01:21

1

我有相似萬阿英,蔣達清,我通過配置解決: 應用程序池 - >高級設置 - >「啓用32位應用程序」爲True

重新啓動IIS和網站。