2010-05-14 21 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方法以實現鎖定機制,以阻止請求,直到第一個成功完成爲止。即使是最輕量級的實現也會影響每個請求,因此您可以選擇僅將其包含在登錄頁面上或其他頁面(因爲用戶未登錄而不會呈現任何內容)。如果錯誤發生在整個站點上,那麼鎖定可能會在每個頁面的基類中結束。

相關問題