title: Verify in advance if assembly can be found
body: <p>My .net program is using an assembly, which should be installed in the GAC.</p>
  
  <p>If the assembly is properly installed, it will be loaded as soon as I use it the first time, which is great. If, for example, I use a type from the assembly like this:</p>
  
  <pre><code>ESRI::ArcGIS::esriSystem::AoInitialize^  aoi = gcnew ESRI::ArcGIS::esriSystem::AoInitializeClass();
  </code></pre>
  
  <p>The assembly will be loaded.</p>
  
  <p>Now sometimes the assembly will not be present in the GAC, and I need the program to be aware of this but not crash.</p>
  
  <p>I tried wrapping the usage of the assembly into a try/catch block like this:</p>
  
  <pre><code>try
  {
    ESRI::ArcGIS::esriSystem::AoInitialize^  aoi = gcnew  ESRI::ArcGIS::esriSystem::AoInitializeClass();
  }
  catch (System::Exception^ )
  {
    // assembly not found
  }
  </code></pre>
  
  <p>But the program will not throw an exception but crash instead.</p>
  
  <p>How can I check in advance, if the assembly is in the GAC and could be used without crashing? Or how could I catch the crash and disable the corresponding menu items in my program?</p>