locked
Upgrading to Windows Azure Storage Client Library 2.0 breaks DiagnosticMonitor RRS feed

  • Question

  • I have upgraded my solution to use Microsoft.WindowsAzure.Storage (the new 2.0 library) via NUGET.

    It seems that the DiagnosticMonitor depends on version 1.7 though - and the solution will not compile - and I get the following error:

    Error 3 The type 'Microsoft.WindowsAzure.CloudStorageAccount' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 

    This occurs on this line of code:

    Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);

    What is the recommended solution here?  It seems to me that Microsoft needs to release a new version of Microsoft.WindowsAzure.Diagnostics to solve the problem.  Does anyone working at Microsoft have any thoughts on this?  Thank you very much.

    Matt







    Tuesday, November 6, 2012 9:19 PM

Answers

  • Hi,

    Thanks for highlighting. It's a known issue that we're working on.


    Allen Chen [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by OceanMorning Monday, November 19, 2012 12:05 PM
    Monday, November 19, 2012 7:47 AM
  • I have not tried it personally but based on what I have heard you could have SDK 1.7 and SDK 1.8 (or 2.0) storage client library coexist in a project as they're separate DLLs and have different namespaces. It was also mentioned that diagnostics library will be modified to take advantage of SDK 1.8.

    Hope this helps.

    Wednesday, November 7, 2012 2:28 AM

All replies

  • Yeah I've been playing around with this for about an hour now, seems the diagnostics tool is dependent on StorageClient, and having both referenced (storage/storageclient) Creates a return type of "error" (great job ms) no further detail no further stack traces.. just error.

    Wednesday, November 7, 2012 2:00 AM
  • I have not tried it personally but based on what I have heard you could have SDK 1.7 and SDK 1.8 (or 2.0) storage client library coexist in a project as they're separate DLLs and have different namespaces. It was also mentioned that diagnostics library will be modified to take advantage of SDK 1.8.

    Hope this helps.

    Wednesday, November 7, 2012 2:28 AM
  • Question is really when, it's as you said, its the dependancy on the old project 1.7, 2.0 is the new upgrade and it seems to have a cross issue on it, need everything up to a 2.0 it seems.

    Just to save my sanity I'll probably be excluding logging until i can upgrade without issue.

    Wednesday, November 7, 2012 3:03 AM
  • Hi Gaurav, thanks for the reply.  Adding a reference to the 1.7 version of StorageClient does solve the problem, but I can't imagine Microsoft would say including two different versions of their storage library is a best practice.  This seems like an oversight on their part.  It seems to me that they need to release a 2.0 version of Microsoft.WindowsAzure.Diagnostics that doesn't depend on the old storage library.


    Wednesday, November 7, 2012 6:23 PM
  • Steps to recreate this issue:

    0.  Use the latest Visual Studio 2010 SP1, with the latest Azure SDK.  Use latest everything.

    1.  Create a new Cloud project.  Add a web role.

    2.  Goto Tools -> Library Package Manager -> Manage NuGet Packages for this Solution...

    3.  Click the "Updates" tab on the left.  Notice that Windows Azure Storage appears as an available upgrade.  Click update and let it install.

    4.  Open WebRole.cs and add the following lines of code directly above the return statement in the OnStart method:

    DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();
    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);

    5. Right-click the solution and select Rebuild Solution.

    Result: the solution will not compile. Here is the error:

    Error 3 The type 'Microsoft.WindowsAzure.CloudStorageAccount' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

    The issue seems to occur with overload 3/3 in DiagnosticMonitor.Start().

    Tuesday, November 13, 2012 5:14 PM
  • Looks like Microsoft has released a new minor version today, 2.0.1.0. 

    Unfortunately, it didn't fix the problem. 

    Also, the documentation/release notes were not updated to indicate what this new version does, or why 1 week after the new 2.0.0.0 library was released a patch came out.  Anyone?

    http://msdn.microsoft.com/en-us/library/windowsazure/jj721952.aspx




    Tuesday, November 13, 2012 9:20 PM
  • Hi,

    Thanks for highlighting. It's a known issue that we're working on.


    Allen Chen [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by OceanMorning Monday, November 19, 2012 12:05 PM
    Monday, November 19, 2012 7:47 AM
  • Thanks Allen.
    Monday, November 19, 2012 12:06 PM
  • Ouch - this hurts! Any ETA on a fix for this?
    Wednesday, December 12, 2012 6:25 PM
  • Hi Allen,

    What's the latest on this? We have upgraded our Storage Client, and we need the diagnostics as well.

    Regards,

    Scott

    Wednesday, February 13, 2013 3:42 AM
  • Scott,

    I was able to work around this Microsoft problem by adding a reference to Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0.  It hasn't caused any issues with my Storage 2.0 code on my production system.

    Hope this helps.

    Matt

    Wednesday, February 13, 2013 1:46 PM
  • I use Windows Azure Storage 2.0.5.0 and still have the same problem. Is this going to be fixed soon?

    When I refer to 1.7.0.0 version, I get this error: 'CloudStorageAccount' is an ambiguous reference between 'Microsoft.WindowsAzure.Storage.CloudStorageAccount' and 'Microsoft.WindowsAzure.CloudStorageAccount'.

    Monday, March 25, 2013 10:01 AM
  • Hey Vaclav,

    I wouldn't recommend waiting on Microsoft for this one :)

    I'd suggest explicitly qualifying CloudStorageAccount.  Instead of this:

    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(cxnString);

    Write this:

    Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(cxnString);

    Or, simply remove "using Microsoft.WindowsAzure;" from the top of your file.

    --Matt


    Monday, March 25, 2013 4:18 PM
  • Building on Matt's answer, there appear to be two different, and mutually incompatible, methods to access cloud storage from Azure as of March 2013 in Azure SDK 1.8 / Azure Storage 2.0. If you are deploying a Cloud Application (*not* an Azure Website), then the code that Matt suggested works the best.

    Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));

    If you are deploying an Azure Website (*not* a Cloud Application), then I've found through trial-and-error that you have to use different code:

    Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse( ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);

    If you accidentally switch these with each other, your code will compile and things will look like they are OK, but they aren't: when you try to run your cloud/website the code will fail silently or almost-silently.

    Also, it is important *not* to use "Microsoft.WindowsAzure.CloudStorageAccount" or just "CloudStorageAccount". You have to use "Microsoft.WindowsAzure.Storage.CloudStorageAccount".

    In addition to differently-versioned but same-named classes of CloudStorageAccount, the latest Azure SDK 1.8 seems to have done the same thing with Table as well. This means that the code you use to read/write Tables in Azure Storage 1.7 (pre-SDK 1.8) is different than the code you use to read/write Tables in Azure Storage 2.0. It helps to fully-qualify the Table classes, similarly to the need to fully-qualify the CloudStorageAccount classes. More information can be found at the following URL. Note that there are two icons at the top of the URL page, "1.7" and "2.0" -- they look like labels, but they are actually clickable buttons, you need to click on each one separately to compare between the two.

    www.windowsazure.com/en-us/develop/net/how-to-guides/table-services/

    Hope this helps.
    • Edited by Earth Atlas Sunday, March 31, 2013 6:09 PM Newline formatting
    Sunday, March 31, 2013 6:08 PM
  • On my systems with azure sdk & tools v1.8 installed when I created web roles with WebRole.cs | OnStart() | DiagnosticMonitor.Start() calls and the current WindowsAzure.Storage v2 nuget package installed i'd get the following compile time error.

    Error ## The type 'Microsoft.WindowsAzure.CloudStorageAccount' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
     
    To resolve i did an add reference | browse | C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-10\ref\Microsoft.WindowsAzure.StorageClient.dll | ok.
     
    After that my WebRole.cs | OnStart() | DiagnosticMonitor.Start() calls compile w/o errors.
     
    As I understand it this issue will be addressed when azure sdk & tools v1.8+ releases at which time I plan to circle back and revert this manually added reference leaving just the WindowsAzure.Storage provided reference.


    • Edited by myusrn Tuesday, April 2, 2013 2:51 PM
    Tuesday, April 2, 2013 2:38 PM
  • Ok, 9 monthes passed through.

    Is there any solution to work with sdk 2.0 without using references to sdk 1.7?

    I mean DiagnosticMonitor.Start() problem.

    Thursday, July 4, 2013 7:59 AM
  • I'm also still running into this problem.  Microsoft: please fix!  Update Diagnostics!
    Tuesday, September 24, 2013 4:37 PM
  • If you install the current azure SDK v2.1 using web platform installer and update the data services nuget packages then nothing special is required.
    Tuesday, September 24, 2013 4:56 PM