Semantic Bug LogToWindowsAzureTable Azure 2.2 SDK

Oct 25, 2013 at 8:31 PM
Edited Oct 25, 2013 at 8:58 PM
When creating a New ObservableEventListener() and creating LogToWindowsAzureTable("","","") with reference to the azure storage 2.1 I get the following error

An unhandled exception of type 'System.IO.FileLoadException' occurred in Microsoft.WindowsAzure.ServiceRuntime.dll

Additional information: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

This is all in a Azure Worker Role:

Steps to reproduce.

Install VS 2013, Install Azure SDK 2.2, Create Cloud Service, Add Worker Role, Add Semantic Logging through Nuget to worker role, add listener:
    public override bool OnStart()
    {
        ServicePointManager.DefaultConnectionLimit = 12;
        var eventTableName = ConfigurationManager.AppSettings["EventsTableName"];


        var listener = new ObservableEventListener();
        listener.LogToWindowsAzureTable("WorkerEvents", @"UseDevelopmentStorage=true",
                                      eventTableName, TimeSpan.FromSeconds(10));
        listener.EnableEvents(WorkerLogs.Log, EventLevel.Verbose, Keywords.All);


        WorkerLogs.Log.ApplicationStarted();

        return base.OnStart();
    }
Editor
Oct 28, 2013 at 4:25 AM
Edited Oct 28, 2013 at 5:40 AM
I think a binding redirect should help. Try adding this to the configuration:
 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.WindowsAzure.Storage"
                          publicKeyToken="31bf3856ad364e35"
                          culture="neutral" />
        <bindingRedirect oldVersion="2.0.0.0"
                         newVersion="2.1.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Nov 4, 2013 at 8:45 PM
i'll give that a try, but seems like a hack rather than a fix, no?