locked
Microsoft.Exchange.Diagnostics.DiagnosticTraceLogging' threw an exception RRS feed

  • Question

  • I am stuck in this issue for long, would really appreciate if anyone can help !!!

    So I have a MVC web application which talks to Web API which calls powershell script. 

    I am using Visual studio 2013 

    Windows 7 64 bit OS

    Exchange server 2010 SP3 ( RollUP 2)

    Requirement -

    We have a class Library application which talks to powershell script to create Distribution list in Active directory. This class library is used by web api, and this web API is called by MVC C# application.

    Problem

    When ever the c# library invokes powershell script , it does add an entry in AD ( as needed) but just after that when it comes back to application it always throws exception, and sometimes logs out the user -

    An unhandled exception occurred and the process was terminated.

    Application ID: /LM/W3SVC/1/ROOT/DLManager_WebAPI_v30

    Process ID: 6604

    Exception: System.TypeInitializationException

    Message: The type initializer for 'Microsoft.Exchange.Diagnostics.DiagnosticTraceLogging' threw an exception.

    StackTrace:    at Microsoft.Exchange.Diagnostics.SystemTraceControl.Update(Dictionary`2 componentDictionary, BitArray enabledTypes, Boolean anyExchangeTracingProvidersEnabled)
       at Microsoft.Exchange.Diagnostics.ExTraceConfiguration.UpdateTrace(ConfigurationDocument traceConfigDoc)
       at Microsoft.Exchange.Diagnostics.ExTraceConfiguration.TraceConfigFileChangeHandler()
       at Microsoft.Exchange.Diagnostics.FileHandler.FileChangeHandler()
       at Microsoft.Exchange.Diagnostics.FileSystemWatcherTimer.Callback(Object arg)
       at System.Threading.TimerCallback.Invoke(Object state)
       at Microsoft.Exchange.Diagnostics.SharedTimer.InternalCallback(Object arg)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.TimerQueueTimer.CallCallback()
       at System.Threading.TimerQueueTimer.Fire()
       at System.Threading.TimerQueue.FireNextTimers()

    InnerException: System.NullReferenceException

    Message: Object reference not set to an instance of an object.

    StackTrace:    at Microsoft.Exchange.Diagnostics.ExTraceInternal.Trace[T0](Int32 lid, TraceType traceType, Guid componentGuid, Int32 traceTag, Int64 id, String format, T0 argument0)
       at Microsoft.Exchange.Diagnostics.DiagnosticTraceLogging.ReportFailure(String failure)
       at Microsoft.Exchange.Diagnostics.DiagnosticTraceLogging.Initialize(Assembly assembly)
       at Microsoft.Exchange.Diagnostics.SystemTrace.SafeInitialize(Assembly assembly)
       at Microsoft.Exchange.Diagnostics.DiagnosticTraceLogging..cctor()

    Would really appreciate any suggestions !! Thanks in advance.

    • Moved by Bill_Stewart Friday, January 29, 2016 3:30 PM Off-topic
    Monday, December 21, 2015 5:58 PM

All replies

  • You need to start with Rollup 6 or later or specify PS version 2.

    You also should post VS questions in  the Visual Studio forum.


    \_(ツ)_/

    Monday, December 21, 2015 6:07 PM