none
BlobType of the blob reference doesn't match BlobType of the blob RRS feed

  • Question

  • Hi again,

    I've noticed a strange behavior. Using the CloudBlobClient.ListBlobsWithPrefix method, I get a blob reference and then when invoking FetchAttributes on this reference, I get exception InvalidOperationException with message "BlobType of the blob reference doesn't match BlobType of the blob ". This is because the reference has BlobType set to page blob but the blob is block blob in my storage. Why/how ListBlobsWithPrefix returns a reference with different blob type?

    Am I missing something?

    The problem occurs with SDK 1.3 and local developer storage.

       Jacek

    Friday, December 17, 2010 11:25 PM

All replies

  • I can't reproduce the issue... this code worked as expected for me:

    var blobs = CloudStorageAccount.DevelopmentStorageAccount.CreateCloudBlobClient();
    var container = blobs.GetContainerReference("documents");
    container.CreateIfNotExist();
    container.GetBlobReference("foo").UploadText("bar");
    container.GetBlobReference("bar").UploadText("baz");
    foreach (var b in blobs.ListBlobsWithPrefix("documents/").OfType<CloudBlob>())
    {
      b.FetchAttributes();
      Console.WriteLine(b.Properties.LastModifiedUtc);
    }
    

    Saturday, December 18, 2010 3:25 AM
  • Hmm, this is even stranger now. Your code copy-pasted to my project, just at the first line of WorkerRole.Run, throws the same exception about mismatched blob types. I've tried container.ListBlobs() with the same result.

    Any ideas? My software config: Win 7 x64, VS 2010, Azure SDK 1.3, and the latest VS Cloud tools downloaded and updated yesterday.

      Jacek

    Saturday, December 18, 2010 11:47 AM
  • That's exactly my setup.  Very strange.  You copy/pasted the exact code?
    Saturday, December 18, 2010 12:32 PM
  • Ok. This is a really messed up thing.

    I created a new cloud project with a single WorkerRole and copied your code to the beginning of the default WorkerRole.Run().

     1: var blobs = CloudStorageAccount.DevelopmentStorageAccount.CreateCloudBlobClient();
     2: var container = blobs.GetContainerReference("documents");
     3: container.CreateIfNotExist();
     4: container.GetBlobReference("foo").UploadText("bar");
     5: container.GetBlobReference("bar").UploadText("baz");
     6: foreach (var b in blobs.ListBlobsWithPrefix("documents/").OfType<CloudBlob>())
     7: {
     8:  b.FetchAttributes();
     9:  Console.WriteLine(b.Properties.LastModifiedUtc);
    10: }
    

    Now, running this works fine until you set a breakpoint somewhere before ListBlobs, say line 6, and use, so called, DataTip on variable b to inspect its properties. Just place mouse over variable b and do open the data tip box to see what's in it. You don't even need to see Properties.BlobType but just open the data tip box. This is enough for VS to change the original value BlockBlob to PageBlob. What is interesting the same issue does not appear with the Watch window. Most likely, DataTip and Watch use different ways to evaluate variables. It's hard to say, however, if this is a bug in VS or Azure SDK.

    Funny...

    And one thing, I have VS 2010 SP1Rel patch installed to correct a bug with step-over/step-into when debugging.

      Jacek

    • Proposed as answer by Pavang6 Tuesday, July 31, 2012 10:58 AM
    Saturday, December 18, 2010 12:45 PM
  • I can confirm this.

    I just ran into this problem while trying to debug something else... this was really throwing me off! If I examined the CloudBlob in the debugger it would later throw this exception when trying to fetch it.

    Wednesday, February 23, 2011 12:29 AM