Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Microsoft.WindowsAzure.Storage (WindowsAzure.Storage) 9.1.1 in a Function is failing on call to Newtonsoft outside of its dependency #194

Closed
justin-typsy opened this issue Apr 19, 2018 · 6 comments
Labels

Comments

@justin-typsy
Copy link

  • I am using a Function
  • I am using WindowsAzure.Storage 9.1.1, it states that it has a dependency on Newtonsoft >= 10.0.2
  • I'm using .NET Framework 4.5
  • I have Newtonsoft 11.0.2 installed (using the method suggested at https://github.com/Azure/azure-functions-vs-build-sdk)
  • When I execute the following code there is an exception on table.ExecuteBatch
  • The code runs fine if called from a Console

InnerException {"Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.":"Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"} System.Exception {System.IO.FileNotFoundException}

public void TableStorageDemo()
{
    storageAccount = CloudStorageAccount.Parse("connection");

    tableClient = storageAccount.CreateCloudTableClient();

    table = tableClient.GetTableReference("TABLE_NAME");

    TableBatchOperation batchOperation = new TableBatchOperation();

    var entity = new Entity();
    entity.Test = "Hello World";

    batchOperation.InsertOrReplace(entity);

    if (batchOperation.Count() > 0) table.ExecuteBatch(batchOperation);
}

Why is the it looking for 10.0.0.0 when it has a dependency on Newtonsoft >= 10.0.2

I have tried with various versions of WindowsAzure.Storage and it only works within the Function when using version 8.7.0 which has a dependency on Newtonsoft >= 6.0.8

Another user can reproduce and suggests this is a bug.

It seems the Function App SDK has a dependency related issue. The issue that it seems not related to WindowsAzure.Storage 9.1.1 itself. As WindowsAzure.Storage 9.1.1 and Newtonsoft 11.0.2 are working correctly in the console application.

More information about the bug detailed here: https://stackoverflow.com/questions/49812091/microsoft-windowsazure-storage-windowsazure-storage-9-1-1-failing-on-call-to-n

@GPugnet
Copy link

GPugnet commented May 10, 2018

I am facing the same issue.
The Newtonsoft reference in https://github.com/Azure/azure-functions-vs-build-sdk/blob/1.0.13/src/Microsoft.NET.Sdk.Functions.Generator/Microsoft.NET.Sdk.Functions.Generator.csproj
is <PackageReference Include="Newtonsoft.Json" Version="[9.0.1]" /> which is causing the issue.

A PR was submitted: #200 but is not yet pushed to nuget.

@Ruud-cb
Copy link

Ruud-cb commented Jun 8, 2018

Any news on when this will be released please?

@larsfagerbakke
Copy link

larsfagerbakke commented Dec 5, 2018

I'm getting the same error, any news about this?

Downgrading WindowsAzure.Storage to 8.7.0 makes it workable again.

@JohnReeson
Copy link

That PR is closed instead of merged. V1 function locks Newtonsoft.Json to 9.0.1 and it won't be changed, see the explanation.

@vijayrkn
Copy link
Collaborator

vijayrkn commented Feb 4, 2019

Related to this issue? #266

@ColbyTresness
Copy link

Closing. Please see explanation.

cofaulco added a commit to SkillsFundingAgency/das-assessor-service that referenced this issue Jan 15, 2020
…on package which occurred preventing the running of the azure functions. This is a recommended workaround as per: Azure/azure-functions-vs-build-sdk#194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants