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

MissingMethodException Document.Build(Assembly, Newtonsoft.Json.Serialization.NamingStrategy) #58

Closed
rychlym opened this issue Aug 21, 2019 · 7 comments

Comments

@rychlym
Copy link

rychlym commented Aug 21, 2019

Hello,

after just upgrading the NuGet package Aliencube.AzureFunctions.Extensions.OpenApi 1.5.4 from 1.5.2 (which was ok) I encountered following exception
requesting any of aliencube API (e.g. http://localhost:7071/api/openapi/v2.json)

MissingMethodException : Method not found: 'Aliencube.AzureFunctions.Extensions.OpenApi.Abstractions.IDocument Aliencube.AzureFunctions.Extensions.OpenApi.Abstractions.IDocument.Build(System.Reflection.Assembly, Newtonsoft.Json.Serialization.NamingStrategy)'

Note, that because of other project libs I needed to enforce Newtonsoft.Json version 11.0.1.

there is my NuGet packages spec in csproj

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />
    <PackageReference Include="Microsoft.SharePointOnline.CSOM" Version="16.1.9021.1200" />
    <PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
    <PackageReference Include="SharePointPnPCoreOnline" Version="3.12.1908" />
  </ItemGroup>
  <ItemGroup Condition="$(DefineConstants.Contains('OPEN_API_HTTPTRIGER'))">
    <PackageReference Include="Aliencube.AzureFunctions.Extensions.OpenApi" Version="1.5.4" />
  </ItemGroup>

As I have mentioned, the Aliencube.AzureFunctions.Extensions.OpenApi version 1.5.2 does not produce such an exception. So it is not critical for me - I just would like to inform you about it...

@justinyoo
Copy link
Contributor

Hi, @rychlym Is it still issue with 1.5.4? Can you please try 1.6.1 and let me know?

@justinyoo
Copy link
Contributor

From 1.7.0, you don't have to rely on this. Please follow the revised document, https://github.com/aliencube/AzureFunctions.Extensions/blob/dev/docs/openapi.md

@rychlym
Copy link
Author

rychlym commented Jul 11, 2020

Hi @justinyoo,
I have tried again with the 1.6.1 and encounterred the exact same exception

<ItemGroup>
  <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />
  <PackageReference Include="Microsoft.SharePointOnline.CSOM" Version="16.1.9119.1200" />
  <PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
  <PackageReference Include="SharePointPnPCoreOnline" Version="3.12.1908" />
</ItemGroup>
<ItemGroup Condition="$(DefineConstants.Contains('OPEN_API_HTTPTRIGER'))">
  <PackageReference Include="Aliencube.AzureFunctions.Extensions.OpenApi" Version="1.6.1" />
</ItemGroup>
<ItemGroup>
  <Reference Include="Microsoft.CSharp" />
</ItemGroup>

 A ScriptHost error has occurred
[7/11/2020 7:23:47 PM] Exception: corelationId: 8386fb78-915d-4939-95b1-4de62440ff7d, type: MissingMethodException : Method not found: 'Aliencube.AzureFunctions.Extensions.OpenApi.Abstractions.IDocument Aliencube.AzureFunctions.Extensions.OpenApi.Abstractions.IDocument.Build(System.Reflection.Assembly, Newtonsoft.Json.Serialization.NamingStrategy)'.
[7/11/2020 7:23:47 PM] Exception: corelationId: 8386fb78-915d-4939-95b1-4de62440ff7d, type: MissingMethodException : Method not found: 'Aliencube.AzureFunctions.Extensions.OpenApi.Abstractions.IDocument Aliencube.AzureFunctions.Extensions.OpenApi.Abstractions.IDocument.Build(System.Reflection.Assembly, Newtonsoft.Json.Serialization.NamingStrategy)'.

and going to try the 1.7.0 ...

@rychlym
Copy link
Author

rychlym commented Jul 11, 2020

hm, it still not working even with the 1.7.0 - the same error
(also tried to update the Microsoft.NET.Sdk.Functions tho the 1.0.37 (supposing still the v1 and still working only with the ver 1.5.2

@justinyoo
Copy link
Contributor

As I can see the SPO related NuGet packages, I assume that you're using AzFunc v1, right? In this case, you can't change the Newtonsoft.Json version. The error you see is because of the version change. Here are many discussions around:

I'm sorry to say that this is out of my control. However, there are possible solutions you might like to consider:

@rychlym
Copy link
Author

rychlym commented Jul 12, 2020

Hi,
Thanks for the info!
Right, I am using the v1 of azure function, as can be seen using the
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />

The v1 is used , because PnPCore library is still not compatible with the .NET Core.
The problem seemed to be, that SharePointPnPCoreOnline was dependant on Newtonsoft.JSON version 11.0.1, and Microsoft.NET.Sdk.Functions was dependand on the verson 9.0.1
Hovewer, reggarding the many discussionos around you mentioned, I finally found a solution at https://github.com/Azure/azure-functions-vs-build-sdk (in the FAQ - it is said to slove that with explicitly referenced Newtonsoft.JSON version package in the .csproj)
Then I added your extension at a time you have released version 1.5.2. and everything worked...

Then I trided to upgrade to your extensions 1.5.4 and since that it stopped to work.

Is your extensions since 1.5.4 dependant on a specific version of the Newtonsoft.JSON?
What if I stay with the 1.5.2.version - will it suffer missing some important features?

Anyway I guess, the 3rd option you posted might be interesting, I wonder if it is possible to use several versions of the one assebly and how to setup it...
Also the option 1 seems to be more possible as of now, because Microsoft recently posted the Sharepoint Online CSOM library started to be compatible with .NET Core, so that SharePointPnPCoreOnline library perhaps could be also compatible with the .NET Core in quite near future...

@justinyoo
Copy link
Contributor

It's really strange...

Is your extensions since 1.5.4 dependant on a specific version of the Newtonsoft.JSON?

The OpenApi extension has a dependency on the Function SDK v1.0.28 - which uses Newtonsoft.Json 9.0.1. I've got sample function apps V1IoC and V1Static with Newtonsoft.Json 9.0.1 and there's no issue. All I can tell you now is that "stick with 9.0.1".

What if I stay with the 1.5.2.version - will it suffer missing some important features?

Well, it keeps improving its feature sets. I'm not sure why it worked on 1.5.2, but not after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants