Bug 8922 - An exception was thrown by the type initializer for System.Web.Script.Serialization.JavaScriptSerializer ---> System.InvalidCastException: Cannot cast from source type to destination type. (When mixing net 4 with assemblies referencing previous versions)
Summary: An exception was thrown by the type initializer for System.Web.Script.Seriali...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web ()
Version: master
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-12-13 15:20 UTC by Pablo Ruiz García
Modified: 2012-12-13 15:21 UTC (History)
2 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 8922 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Pablo Ruiz García 2012-12-13 15:20:20 UTC

This bug is not new, as it existed already on novell's bugzilla for a while: https://bugzilla.novell.com/show_bug.cgi?id=664813

However, it remains open, and even if Marek's proposed workaround works fine (thnks Marek), this problem simply does not exists on MS.NET side, so I feel there's a need for a runtime-wide fix not involving an assembly redirect on the app's .config file.

Robert Jordan proposed adding an entry to remapped-assemblies list, and Marek rejected the idea as it would break existing software like Telerik's suite.

I could spare some time trying to fix this at a system-wide/runtime level, Marek, do you have any proposal or alternative I could look into?