CRM 2011 – plugins and isolation mode

Posted on March 13, 2013

4


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
Posted in: CRM 2011, plugins