CRM 2011 – plugins and isolation mode

I had a frustrating afternoon the other week, when I wrote a simple plugin but the plugin was throwing an error in the first line of code.

The plugin compiled without problem.

In the end I took out all the code except for some logging statements but it was still throwing an error.

This particular project we were using log4net, which is offers a good middle ground if there are a lot of developers all interested in getting logging information and debugging their various plugins etc.

I should also mention I was using the CRM developer visual studio add in.

I went over all the areas which might cause problems and got to the RegisterFile.crmregister.  This file contains the plugin details, information like what entity, when the plugin is triggered.

I then noticed the problem (I say me it was actually a fellow developer who told me to check it) but the isolation mode was defaulted to Sandbox as you can see from the line below

    <Solution Assembly=”test.Plugins.dll” Id=”55b7d62d-9111-e111-8eab-1cc1dee89a7f” IsolationMode=”Sandbox” SourceType=”Database”>

The reason why my plugin was crashing was being the Log4net was using a a third party dll which was held in the GAC.  Plugins which use the isolationMode of Sandbox are not allowed to call any dll’s otherwise they throw an error.

I changed the isolation mode to none and it worked.  Pity it took me 2 or 3 hours to work.

 

About these ads

6 thoughts on “CRM 2011 – plugins and isolation mode

  1. wos March 17, 2013 / 1:22 pm

    Hi Hosk,

    This only works if you are writing an plugin for on-premise or IVF as your plugin must run in Sandbox mode for CRM online.

    Nevertheless, I have been reading your blog for a couple of months now and I have been really enjoying it. Keep on going!

    So long,

    Wos

  2. nuneuro86 October 1, 2014 / 4:58 am

    Hi Ben,

    Suppose I need to reference external DLL’s and I have CRM 2013 Online.

    What would you recommend as the best options?

    Cheers,

    Stanley

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s