title: C# Get video file duration from metadata
body: <p>I am trying to read metadata from a file.  I only need the Video -> Length property, however I am unable to find a simple way of reading this information.</p>
  
  <p>I figured this would be fairly easy since it is visible by default in Explorer, however this looks to be way more complicated than I anticipated. The closest I came was using:</p>
  
  <pre><code>Microsoft.DirectX.AudioVideoPlayback.Video video = new Microsoft.DirectX.AudioVideoPlayback.Video(str);
  double duration = video.Duration;
  </code></pre>
  
  <p>However this throws a LoaderLock exception, and I don't know how to deal with it.</p>
  
  <p>Any ideas?</p>