web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Getting System.MethodAccessException when I use JavaScriptSerializer in sandboxed plugin

(0) ShareShare
ReportReport
Posted on by 255

 

Hi all,

 

I developed a sandboxed plugin for Dynamics CRM 2011,where I need to use XML and JSON serialization.But when I started to debug the plugin , I was geting the error below:

 

Unexpected exception from plug-in (Execute): "MyPlugin Name" : System.MethodAccessException: Attempt by security transparent method "the stack trace of the method I use Javascript serialization"

to access security critical method 'System.Web.Script.Serialization.JavaScriptSerializer..ctor()' failed. Assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is a conditionally APTCA assembly which is not enabled in the current AppDomain. To enable this assembly to be used by partial trust or security transparent code, please add assembly name 'System.Web.Extensions, PublicKey=0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9' to the the PartialTrustVisibleAssemblies list when creating the AppDomain.

Whatever I tried ,did not matter. The error is still there.

Now , I think If I will not be able to use even the XML or JavaScript serializations , why is there a sandboxed solution , just for hard coding ? 

I hope some of you already figured out how to use such a kind of nice assemblies in sandboxed plugins.

Regards,

 

Erhan Akova

http://www.isvlabs.com

 

*This post is locked for comments

I have the same question (0)
  • navi ghag Profile Picture
    70 on at

    is there any solution for this error?

    What are the other ways of transferring data from CRM?

  • Suggested answer
    Hosk Profile Picture
    on at

    To resolve this error you need to change the isolation mode = "none"

  • Suggested answer
    Community Member Profile Picture
    on at

    If you Debug the plugin using Plugin Registration Tool, you need to set Isolation mode "None" in Plugin Execution Settings tab. By default it is "Based on Profile".

  • Community Member Profile Picture
    on at

    What is the resolution for this issue? I am facing the same issue, changing the isolation mode to none in plug in registration tool is fixed the issue for debugging however method is failing when its executed with in CRM online sanbox.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans