title: Reporting Services Custom Assembly
body: <p>I created a custom assembly to convert RTF to plain text and it works nice with the following configuration:  SSRS 2008, Win 2003 Server, rssrvpolicy.config changes, an Excecution Account, and IIS 6.0. </p>
  
  <p>We created a new server running SSRS 2008R2, Win 2008, and IIS 7.  It does not work on this new environment and I do not get any error, but instead the SSRS Service reboots itself.  This only happens when I reference System.Windows.Forms.RichTextBox().  See code below.</p>
  
  <p>Can anyone give me an idea of what I may need to do or test to get this working?  I've checked the log files and the Event Viewer, but not seeing any errors.  It does call my assembly and works if I just output some text to the report and not call the RichTextControl.  It fails when I try to reference System.Windows.Forms.RichTextBox.  I also installed to the GAC with no luck, but shouldn't need to(?) and didn't with the old version.</p>
  
  <p>I also tried to put a try/catch block around the code to see if I could get the error.  If I just throw an error, I get the message.  If I call the RichTextBox control, it causes the SSRS service to reboot.</p>
  
  <p>My code:</p>
  
  <pre><code>using System;
  using System.Windows.Forms;
  using System.Diagnostics;
  namespace ConversionUtility
  {
      public class ConversionUtility
      {
          [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Assert, Unrestricted = true)] 
          public static string ConvertRTFToText(string richText)
          {
              string sText = "";
  
              try
              {
                  // if I comment out these 3 lines, this will work
                  RichTextBox richTextBox = new System.Windows.Forms.RichTextBox();
                  richTextBox.Rtf = richText;
                  sText = richTextBox.Text;
                  //throw new Exception("Log this error");
              }
              catch (Exception e)
              {
                  sText = "Error Caught: " + e.Message;
              }
  
              return sText;
          }
      }
  }
  </code></pre>
  
  <p>I have these permissions defined.  I add the CodeGroup below and it works if I don't reference the RichTextBox.  The service reboots as soon as I try to reference System.Forms.Windows.RichTextBox()</p>
  
  <pre><code>&lt;CodeGroup
  class="UnionCodeGroup"
  version="1"
  Name="SecurityExtensionCodeGroup"
  Description="Code group Conversion Utility"
  PermissionSetName="FullTrust"&gt;
  &lt;IMembershipCondition
      class="UrlMembershipCondition"
      version="1"
      Url="C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin        \ConversionUtility.dll"
  /&gt;
  </code></pre>
  
  <p></p>
  
  <p>I'm thinking it's having an issue with permissions to System.Windows.Forms, but haven't been able to figure out what I need to do.</p>
  
  <p>Thanks in advance,</p>
  
  <p>Randy</p>