Spring.net 1.3.2 で ASP.Net 4 Web サイトをセットアップしようとしています。
基本的なページの場合、Spring は問題なくページをロードし、依存関係を問題なく注入します。ただし、一部のページでは、ctor と Page_Load の間で NullReferenceException が発生し、次の情報が表示されます。
メッセージ:
Value cannot be null.
Parameter name: methodInfoDeclaration
スタックトレース:
at System.Reflection.Emit.TypeBuilder.DefineMethodOverrideNoLock(MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration)
at System.Reflection.Emit.TypeBuilder.DefineMethodOverride(MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration)
at Spring.Proxy.AbstractProxyMethodBuilder.BuildProxyMethod(MethodInfo method, MethodInfo interfaceMethod) in c:\_prj\spring-net\trunk\src\Spring\Spring.Core\Proxy\AbstractProxyMethodBuilder.cs:line 107
at Spring.Web.Support.SupportsWebDependencyInjectionTypeBuilder.BuildProxyType()
at Spring.Web.Support.InterceptControlCollectionStrategy.GetInterceptedCollectionType(Type controlCollectionType, InjectDependenciesCallbackHandler staticCallback)
at Spring.Web.Support.InterceptControlCollectionStrategy.GetInterceptedCollectionFactory(Type ownerType, Type collectionType)
at Spring.Web.Support.InterceptControlCollectionStrategy.InterceptCollection(Control owner, ControlCollection originalCollection)
at Spring.Web.Support.InterceptControlCollectionStrategy.Intercept(IApplicationContext defaultApplicationContext, ControlAccessor ctlAccessor, ControlCollectionAccessor ctlColAccessor)
あるページで の問題に絞り込みましたが、SiteMapDataSource
コメントすると例外が消えます。ただし、例外は引き続き他のページに表示されます。
他の場所でも同様のエラーを起こしている人を見つけました: http://forum.springframework.net/showthread.php?6621-Spring.NET-ASP.NET-4.0-Error
ただし、関連するバグはバージョン 1.3.1 で修正されています。
私の Web.config の関連部分は次のとおりです。
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
</sectionGroup>
[...]
<httpHandlers>
<add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web" />
</httpHandlers>
<httpModules>
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
</httpModules>
そして私のオブジェクト定義:
<object type="Default.aspx">
<property name="TestProperty" value="Spring injected" />
</object>
この例外を回避する方法を教えてもらえますか?