This project is read-only.

Object reference not set to an instance of an object.

Jan 19, 2014 at 7:18 AM
Edited Jan 19, 2014 at 12:21 PM

I recently changed my project to use .Net 4.0 instead of .Net 2.0. And while testing I discovered that AlphaVSS regularly throws an exception during either one of these calls:
 using (Alphaleonis.Win32.Vss.IVssAsyncResult async = _VssBComp.BeginPrepareForBackup(null, null))
      bool bWait = async.AsyncWaitHandle.WaitOne(5 * 60 * 1000);
           throw new ExternalException("VSS Begin Prepare For Backup Timed out");
using (Alphaleonis.Win32.Vss.IVssAsyncResult async = _VssBComp.BeginDoSnapshotSet(null,null))
      bool bWait = async.AsyncWaitHandle.WaitOne(5 * 60 * 1000);
      if (!bWait)
          throw new ExternalException("VSS Begin Do Snapshot Set Timed out");
Here is the stack trace for the crash.
Stack Trace: at Alphaleonis.Win32.Vss.VssAsyncResult.WaitForAsyncCompletion(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
The problem is even if both calls are encapsulated by a try/catch, I am unable to catch the exception which causes my application to crash. I am not sure why this is happening as I did not experience such behavior in the past.
Any help is appreciated