IVssAsync instance now has become synchronous

Apr 20, 2012 at 1:57 PM

I need some help on the new .NET 4.0 APIs

In the sample application posted the following code works great under the old APIs

 Using async As Alphaleonis.Win32.Vss.IVssAsync = oVSS.GatherWriterMetadata()
            End Using
But how would I do it now that IVssAsync is now not available?
The only thing I can find on the MSDN site is
HRESULT GatherWriterMetadata(
  [out]  IVssAsync **ppAsync

And that still uses IVssAsync
I m not looking for code per say, just to be pointed in the right direction, but if you have some code to share, I m not going to refuse it.
I look forward to any help you guys can provide, Thanks!
Apr 20, 2012 at 5:32 PM
Edited Apr 20, 2012 at 5:33 PM

Nice formatting! I guess everything is source-code to a true developer! ;)

Anyway, the sample applications included in the source code should provide details on how everything is used.

Now there is a synchronous version of GatherWriterMetadata(), meaning to replicate what you did before, i.e. call the method and wait for it to complete you simply call the method:


It will not return until the operation is completed.

If you need asynchronous behavior, you would use the BeginGatherWriterMetadata() and EndGatherWriterMetadata() pair of methods, for example like:

IAsyncResult ar = backup.BeginGatherWriterMetadata(null, null);          

(Sorry for the C# in this example, but I'm not a VB programmer).

For more information about this standard .NET pattern, see http://msdn.microsoft.com/en-us/library/ms228963.aspx.

Hope this helps...

Apr 6, 2013 at 3:30 PM
       Using async As IVssAsyncResult = oVSS.BeginGatherWriterMetadata(Nothing, Nothing)
        End Using