Bug 8656 - JavaScriptSerializer was gone with System.TypeInitializationException on runtime.
Summary: JavaScriptSerializer was gone with System.TypeInitializationException on runt...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-11-29 04:41 UTC by Keiichi Iguchi
Modified: 2015-12-24 23:30 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Keiichi Iguchi 2012-11-29 04:41:13 UTC
Our server began to throw following exceptions suddenly.
It was recovered when Apache was restarted. 


System.TypeInitializationException: An exception was thrown by the type initializer for System.Web.Script.Serialization.JavaScriptSerializer ---> System.MethodAccessException: Method `System.Web.HttpApplication:LoadType (string,bool)' is inaccessible from method `System.Web.Script.Serialization.JavaScriptSerializer:.ctor (System.Web.Script.Serialization.JavaScriptTypeResolver,bool)'
        
          at System.Web.Script.Serialization.JavaScriptSerializer..cctor () [0x00000] in <filename unknown>:0 
          --- End of inner exception stack trace ---
          at System.Web.Mvc.JsonResult.ExecuteResult (System.Web.Mvc.ControllerContext context) [0x00000] in <filename unknown>:0 
          at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000] in <filename unknown>:0 
          at System.Web.Mvc.ControllerActionInvoker+<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19 () [0x00000] in <filename unknown>:0 
          at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter (IResultFilter filter, System.Web.Mvc.ResultExecutingContext preContext, System.Func`1 continuation) [0x00000] in <filename unknown>:0     Stack =   at System.Web.Mvc.JsonResult.ExecuteResult (System.Web.Mvc.ControllerContext context) [0x00000] in <filename unknown>:0 
          at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000] in <filename unknown>:0 
          at System.Web.Mvc.ControllerActionInvoker+<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19 () [0x00000] in <filename unknown>:0 
          at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter (IResultFilter filter, System.Web.Mvc.ResultExecutingContext preContext, System.Func`1 continuation) [0x00000] in <filename unknown>:0
Comment 1 eetasoft 2015-12-24 23:30:40 UTC
This bug is also present in 4.2.2  using Apache+mod_mono

It occurs after some time of work in line 53 in

/usr/local/src/mono-4.2.2/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JavaScriptSerializer.cs:53 


[System.TypeInitializationException]: The type initializer for &#39;System.Web.Helpers.Json&#39; threw an exception.
  at MyApp.Business.ViewBase`1[T].Serialize (System.String s) <0x40670d30 + 0x00023> in <filename unknown>:0 
  at MyApp.Business.ViewBase`1[T].IR (System.String s) <0x40670ce0 + 0x00033> in <filename unknown>:0 
  at ASP._Page_Views_Shared_Site_cshtml.Execute () <0x40655010 + 0x006cb> in <filename unknown>:0 
  at System.Web.WebPages.WebPageBase.ExecutePageHierarchy () <0x405b5330 + 0x0011b> in <filename unknown>:0 
  at System.Web.Mvc.WebViewPage.ExecutePageHierarchy () <0x405b5200 + 0x0005f> in <filename unknown>:0 
  at System.Web.WebPages.WebPageBase.ExecutePageHierarchy (System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) <0x405b3600 + 0x000f4> in <filename unknown>:0 
  at System.Web.WebPages.WebPageBase.ExecutePageHierarchy (System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) <0x40654fe0 + 0x0001b> in <filename unknown>:0 
  at System.Web.WebPages.WebPageBase+<>c__DisplayClass7.<RenderPageCore>b__6 (System.IO.TextWriter writer) <0x40653f90 + 0x0018b> in <filename unknown>:0 
  at System.Web.WebPages.HelperResult.WriteTo (System.IO.TextWriter writer) <0x405ba3d0 + 0x00023> in <filename unknown>:0 
  at System.Web.WebPages.WebPageExecutingBase.WriteTo (System.IO.TextWriter writer, System.Web.WebPages.HelperResult content) <0x405ba390 + 0x00027> in <filename unknown>:0 
  at System.Web.WebPages.WebPageBase.Write (System.Web.WebPages.HelperResult result) <0x405ba350 + 0x00023> in <filename unknown>:0 
  at System.Web.WebPages.WebPageBase.RenderSurrounding (System.String partialViewName, System.Action`1 body) <0x40653c10 + 0x0009b> in <filename unknown>:0 
  at System.Web.WebPages.WebPageBase.PopContext () <0x4064ded0 + 0x001c3> in <filename unknown>:0 
  at System.Web.WebPages.WebPageBase.ExecutePageHierarchy (System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) <0x405b3600 + 0x000ff> in <filename unknown>:0 
  at System.Web.Mvc.RazorView.RenderView (System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer, System.Object instance) <0x405b0a60 + 0x00227> in <filename unknown>:0 
  at System.Web.Mvc.BuildManagerCompiledView.Render (System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer) <0x405b0680 + 0x000a8> in <filename unknown>:0 
  at System.Web.Mvc.ViewResultBase.ExecuteResult (System.Web.Mvc.ControllerContext context) <0x405a3710 + 0x001e8> in <filename unknown>:0 
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) <0x405a36e0 + 0x0001d> in <filename unknown>:0 
  at System.Web.Mvc.ControllerActionInvoker+<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17 () <0x405a3660 + 0x0001f> in <filename unknown>:0 
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter (IResultFilter filter, System.Web.Mvc.ResultExecutingContext preContext, System.Func`1 continuation) <0x405a33a0 + 0x000cf> in <filename unknown>:0 

[System.TypeInitializationException]: The type initializer for &#39;System.Web.Script.Serialization.JavaScriptSerializer&#39; threw an exception.
  at System.Web.Helpers.Json.CreateSerializer () <0x40670de0 + 0x00027> in <filename unknown>:0 
  at System.Web.Helpers.Json..cctor () <0x40670db0 + 0x0000b> in <filename unknown>:0 

[System.MethodAccessException]: Method `System.Web.HttpApplication:LoadType (string,bool)&#39; is inaccessible from method `System.Web.Script.Serialization.JavaScriptSerializer:.ctor (System.Web.Script.Serialization.JavaScriptTypeResolver,bool)&#39;

  at System.Web.Script.Serialization.JavaScriptSerializer..cctor () [0x00000] in /usr/local/src/mono-4.2.2/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JavaScriptSerializer.cs:53

Note You need to log in before you can comment on or make changes to this bug.