ASP.Net引发错误" System.InvalidOperationException:集合被修改;"切换到越南语时

时间:2015-09-22 07:34:12

标签: asp.net .net c#-4.0

环境:操作系统Windows 2008 R2 Sp1,IIS 7.5,应用程序池CLR .Net 4 x64(集成模式)。

我们的生产网站是ASP.net网站(不是网络应用程序),它支持6种语言的UI文化,如下所示:

  

en-US,ja-JP,th-TH,zh-CN,zh-TW,ko-KR和vi-VN。

该网站与除越南语之外的所有语言完美配合。有时,当我们将语言更改为越南语时,某些页面会抛出异常,如下所示

 System.InvalidOperationException: Collection was modified; enumeration operation may not execute. 
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark) 
at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark) 
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark) 
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark) 
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) 
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture) 
at Resources.Lang.get_noofticket() 

查看错误消息,我们了解到当调用Resource.Lange.get_nooticket()并抛出异常的方法时发生错误

System.Reflection.RuntimeAssembly
_nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean, Boolean).

Resource.Lang是全局资源文件。 我们什么都没发现"特别"关于越南资源文件,但越南资源文件中缺少一些密钥。但是,据我所知,它不可能是问题,因为ResourceManager可以自动切换到默认文化(英文)来获取资源值。而且,这个bug并不经常发生,我们也不知道如何重现。

我们还有来自转储文件的报告如下:

KERNELBASE!RaiseException+39 
MSVCR100_CLR0400!CxxThrowException+81 
clr!AssemblySpecBindingCache::AssemblyBinding::ThrowIfError+38 
clr! ?? ::FNODOBFM::`string'+6f100 
clr!AssemblySpec::LoadDomainAssembly+129 
clr!AssemblySpec::LoadAssembly+1b 
clr!AssemblyNative::Load+26a 
[[HelperMethodFrame_PROTECTOBJ] (System.Reflection.RuntimeAssembly._nLoad)] System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMarkByRef, Boolean, Boolean, Boolean) 
mscorlib_ni!System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(System.String, System.Globalization.CultureInfo, System.Version, Boolean, System.Threading.StackCrawlMark ByRef)+ee 
mscorlib_ni!System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(System.Globalization.CultureInfo, System.Threading.StackCrawlMark ByRef)+d7 
mscorlib_ni!System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(System.Globalization.CultureInfo, System.Collections.Generic.Dictionary`2<System.String,System.Resources.ResourceSet>, Boolean, Boolean, System.Threading.StackCrawlMark ByRef)+e2 
mscorlib_ni!System.Resources.ResourceManager.InternalGetResourceSet(System.Globalization.CultureInfo, Boolean, Boolean, System.Threading.StackCrawlMark ByRef)+268 
mscorlib_ni!System.Resources.ResourceManager.InternalGetResourceSet(System.Globalization.CultureInfo, Boolean, Boolean)+23 
mscorlib_ni!System.Resources.ResourceManager.GetString(System.String, System.Globalization.CultureInfo)+13c 
Resources.Lang.get_noofticket()+5b 
Fanex.Age.UI.Reports.Winloss.WinlossDetailMaster_ExcelContents_Block.get_s32()+28 
Fanex.Age.UI.Reports.Winloss.WinlossDetailMaster_ExcelContents_Block.ToString(System.Text.StringBuilder ByRef)+3ce 
Fanex.Age.UI.Reports.Winloss.WinlossDetailMaster_Template.ToString(System.Text.StringBuilder ByRef)+40d 
Fanex.Age.UI.Reports.Winloss.WinlossDetailMaster_Page.RenderContent(System.Web.UI.HtmlTextWriter)+1fa 
Fanex.Age.UI.TplPage.Render(System.Web.UI.HtmlTextWriter)+293 
System_Web_ni!System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)+149a 
System_Web_ni!System.Web.UI.Page.ProcessRequest(Boolean, Boolean)+c1 
System_Web_ni!System.Web.UI.Page.ProcessRequest()+77 
System_Web_ni!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)+a7 
System_Web_ni!System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+255 
System_Web_ni!System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)+10a 
System_Web_ni!System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)+6d9 
System_Web_ni!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)+85 
System_Web_ni!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)+2c6 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)+3bf 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)+22 
System_Web_ni!DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)+51 
clr!UMThunkStubAMD64+77 
webengine4!W3_MGD_HANDLER::ProcessNotification+79 
webengine4!W3_MGD_HANDLER::DoWork+310 
webengine4!RequestDoWork+42d 
webengine4!CMgdEngHttpModule::OnExecuteRequestHandler+24 
iiscore!NOTIFICATION_CONTEXT::RequestDoWork+233 
iiscore!NOTIFICATION_CONTEXT::CallModulesInternal+174 
iiscore!NOTIFICATION_CONTEXT::CallModules+25 
iiscore!W3_CONTEXT::DoWork+34d 
iiscore!W3_CONTEXT::IndicateCompletion+8c 
webengine4!W3_MGD_HANDLER::IndicateCompletion+59 
webengine4!MgdIndicateCompletion+22 
clr!DoNDirectCall__PatchGetThreadCall+7b 
System_Web_ni!DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus ByRef)+57 
[[NDirectMethodFrameStandalone] (System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion)] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatusByRef) 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)+4f4 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)+22 
System_Web_ni!DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)+51 
clr!UM2MThunk_WrapperHelper+4b 
clr!UM2MThunk_Wrapper+90 
clr!Thread::DoADCallBack+127 
[[ContextTransitionFrame]] 
clr!UM2MDoADCallBack+9e 
clr!UMThunkStubAMD64+273 
webengine4!W3_MGD_HANDLER::ProcessNotification+79 
webengine4!ProcessNotificationCallback+43 
clr!UnManagedPerAppDomainTPCount::DispatchWorkItem+181 
clr!ThreadpoolMgr::NewWorkerThreadStart+2e5 
clr!ThreadpoolMgr::WorkerThreadStart+3b 
clr!Thread::intermediateThreadProc+7d 
kernel32!BaseThreadInitThunk+d 
ntdll!RtlUserThreadStart+1d 

我们确实尝试过读取mscorlib的源代码,但System.Reflection.RuntimeAssembly._nLoad让我们陷入了死胡同。为什么问题只发生在越南语?

如果你能给我一些解决这个问题的线索,我将不胜感激。

0 个答案:

没有答案