title: Couldn't find type for class Microsoft.WindowsAzure.Diagnostics
body: <p>Just got back from holidays, and went in to make a couple small changes in our app, when I was confronted by this error:</p>
  
  <blockquote>
    <p>Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.</p>
  </blockquote>
  
  <p>The code had been running perfectly prior to coming back from holidays. It was last published to Azure 3 weeks ago, and it is now having the same issue there. Locally I attempted to fix it by removing add adding the following config section back:</p>
  
  <pre><code>&lt;system.diagnostics&gt;
      &lt;trace&gt;
          &lt;listeners&gt;
              &lt;add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics"&gt;
              &lt;/add&gt;
          &lt;/listeners&gt;
      &lt;/trace&gt;
  &lt;/system.diagnostics&gt;
  </code></pre>
  
  <p>Add adding and removing the Reference to the assembly:</p>
  
  <p><img src="https://i.stack.imgur.com/zUcyv.png" alt="enter image description here"></p>
  
  <p>When I debug the project locally, Visual Studio breaks on the following line:</p>
  
  <pre><code>NewRelic.Api.Agent.NewRelic.IgnoreTransaction();
  </code></pre>
  
  <p>This had been working both locally and in production until 2 days ago (according to the error log).</p>
  
  <p>Full Stack Trace:</p>
  
  <pre><code>[ConfigurationErrorsException: Couldn't find type for class Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.]
     System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) +6755367
     System.Diagnostics.TypedElement.BaseGetRuntimeObject() +45
     System.Diagnostics.ListenerElement.GetRuntimeObject() +83
     System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +143
     System.Diagnostics.TraceInternal.get_Listeners() +181
     System.Diagnostics.TraceInternal.WriteLine(String message) +119
     System.Diagnostics.Trace.WriteLine(String message) +4
     NewRelic.Api.Agent.NewRelic.IgnoreTransaction() +13
     Linklicious2.Controllers.ApiController.GetLinksToPing(Boolean test) +46
     lambda_method(Closure , ControllerBase , Object[] ) +98
     System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
     System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +214
     System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
     System.Web.Mvc.&lt;&gt;c__DisplayClass15.&lt;InvokeActionMethodWithFilters&gt;b__12() +55
     System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
     System.Web.Mvc.&lt;&gt;c__DisplayClass17.&lt;InvokeActionMethodWithFilters&gt;b__14() +21
     System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
     System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324
     System.Web.Mvc.Controller.ExecuteCore() +106
     System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +91
     System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
     System.Web.Mvc.&lt;&gt;c__DisplayClassb.&lt;BeginProcessRequest&gt;b__5() +34
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0() +19
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass8`1.&lt;BeginSynchronous&gt;b__7(IAsyncResult _) +10
     System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
     System.Web.Mvc.&lt;&gt;c__DisplayClasse.&lt;EndProcessRequest&gt;b__d() +48
     System.Web.Mvc.SecurityUtil.&lt;GetCallInAppTrustThunk&gt;b__0(Action f) +7
     System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
     System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
     System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9631764
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
  </code></pre>