Results 1 to 3 of 3

Thread: Custom resourceProviderFactoryType

  1. #1
    Join Date
    Oct 2008
    Posts
    4

    Question Custom resourceProviderFactoryType

    Hi,

    i have some problem with resource management.
    If i add to web.config:

    <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" resourceProviderFactoryType="myCustomProviderFacto ry"/>

    i get such exception:

    [NullReferenceException: Object reference not set to an instance of an object.]
    Spring.Web.UI.Page.GetLocalResourceManager() in l:\projects\spring-net\trunk\src\Spring\Spring.Web\Web\UI\Page.cs:159 5
    Spring.Web.UI.Page.InitializeMessageSource() in l:\projects\spring-net\trunk\src\Spring\Spring.Web\Web\UI\Page.cs:156 0
    Spring.Web.UI.Page.OnPreInit(EventArgs e) in l:\projects\spring-net\trunk\src\Spring\Spring.Web\Web\UI\Page.cs:218
    System.Web.UI.Page.PerformPreInit() +31
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282

    Maybe there is a workaround to this problem.
    I am using 1.2.0-RC1 version.

  2. #2
    Join Date
    Oct 2008
    Posts
    4

    Default

    My custom resource provider does not have method "GetLocalResourceAssembly"
    so i have changed code in Spring.Web.UI.Page class (added check for null) and my web application stoped crashing.

    private ResourceManager GetLocalResourceManager()
    {
    if !NET_2_0
    return new ResourceManager(GetType().BaseType);
    #else
    object resourceProvider = GetLocalResourceProvider.Invoke( typeof( ResourceExpressionBuilder ), new object[] { this } );
    MethodInfo GetLocalResourceAssembly =
    resourceProvider.GetType().GetMethod( "GetLocalResourceAssembly", BindingFlags.NonPublic | BindingFlags.Instance );
    if (GetLocalResourceAssembly != null)
    {

    Assembly localResourceAssembly = (Assembly)GetLocalResourceAssembly.Invoke(resource Provider, null);
    if (localResourceAssembly != null)
    {
    return new ResourceManager(VirtualPathUtility.GetFileName(thi s.AppRelativeVirtualPath), localResourceAssembly);
    }
    }

    return null;
    #endif
    }

  3. #3
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi,

    Thanks a lot for reporting and investigating this. I recorded your issue as SPRNET-1085. You will find your fix in the upcoming release.

    cheers,
    Erich

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •