2010-05-14 67 views
0

我正在开发一个使用AjaxControlkit 3.0.30512.20315的ASP.NET Web应用程序。我的主页上有一个ToolkitScriptManager实例,CombineScripts集合中有ScriptReferences。 如果我的iisreset访问后,从2个differenct客户我的默认页,我得到下面的异常ToolkitScriptManager第一次在并发访问页面期间抛出NullReferenceException

[NullReferenceException: Object Reference not set to an instance of an object.] 
    System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +143 
    System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value) +11 
    AjaxControlToolkit.ToolkitScriptManager.GetScriptCombineAttributes(Assembly assembly) +129 
    AjaxControlToolkit.ToolkitScriptManager.IsScriptCombinable(ScriptEntry scriptEntry) +148 
    AjaxControlToolkit.ToolkitScriptManager.OnResolveScriptReference(ScriptReferenceEventArgs e) +415 
    System.Web.UI.ScriptManager.RegisterScripts() +191 
    System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +113 
    System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8698462 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029 

使用.NET Reflector我发现了GetScriptCombineAttributes方法访问static dictionary,这是not protected against concurrent access。 要么我在我的代码中有竞争条件,要么在AjaxToolkit中有一个错误。

有人可以给我一个暗示吗?

在此先感谢

+0

你有没有遇到过这种情况? – ilivewithian 2010-11-08 11:41:23

+0

“与2013年1月发布的Ajax控件工具包一起修复” – user423430 2013-05-22 20:11:19

回答

-1

此bug已被第一家官方的ASP.NET AJAX Control Toolkit的网站上报道,六月在这里2010年1个投票:

http://ajaxcontroltoolkit.codeplex.com/workitem/26752

由于内发生ASP.NET管道的页面部分,您可以尝试重写OnPreRenderComplete方法以实现锁定机制,以阻止请求,直到第一个成功完成为止。即使是最轻量级的实现也会影响每个请求,因此您可以选择仅将其包含在登录页面上或其他页面(因为用户未登录而不会呈现任何内容)。如果错误发生在整个站点上,那么锁定可能会在每个页面的基类中结束。

相关问题