OpenAPI.NET.CSharpAnnotations icon indicating copy to clipboard operation
OpenAPI.NET.CSharpAnnotations copied to clipboard

Newtonsoft.Json failing to load in ADO build task

Open ghost opened this issue 6 years ago • 6 comments

Hi,

I have been attempting to add an OpenAPI build task to my Azure DevOps pipeline, but am currently stuck on receiving an error whenever I attempt to build my document:

ExceptionType: FileLoadException || Message: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.
    GET /api/v1/xxx || ExceptionType: AddingSchemaReferenceFailedException || Message: Adding schema "xxx.ValidationError" to the schema reference registry failed with the error: Adding schema "System.Collections.Generic.List_xxx.ApiError_" to the schema reference registry failed with the error: Adding schema "xxx.ApiError" to the schema reference registry failed with the error: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)...

I'm not sure how this error is arising - I've imported the same version of Newtonsoft.Json via NuGet in every project in my solution, and I import all .dll dependencies from the same dotnet build task (project info redacted):

Found: "C:\vsts-agent-win-x64-2.144.0\_work\4\s\xxx\xxx.xml"
Searching for pattern "xxx\bin\Release\**\publish\xxx*.dll" under "C:\vsts-agent-win-x64-2.144.0\_work\4\s" path.
Found: "C:\vsts-agent-win-x64-2.144.0\_work\4\s\xxx\bin\Release\netcoreapp2.2\publish\xxx1.dll", "C:\vsts-agent-win-x64-2.144.0\_work\4\s\xxx\bin\Release\netcoreapp2.2\publish\xxx2.dll", "C:\vsts-agent-win-x64-2.144.0\_work\4\s\xxx\bin\Release\netcoreapp2.2\publish\xxx3.dll", "C:\vsts-agent-win-x64-2.144.0\_work\4\s\xxx\bin\Release\netcoreapp2.2\publish\xxx4.dll"
Searching for pattern "xxx\bin\Release\**\publish\Newtonsoft.Json.dll" under "C:\vsts-agent-win-x64-2.144.0\_work\4\s" path.
Found: "C:\vsts-agent-win-x64-2.144.0\_work\4\s\xxx\bin\Release\netcoreapp2.2\publish\Newtonsoft.Json.dll"

Is there something I might be missing?

ghost avatar Mar 20 '19 02:03 ghost

@jublair I am working on a fix in the library that should try to resolve the assembly conflicts if found any and hoping that should fix this Azure DevOps task issue too, i will keep you updated on the progress made.

Shwetap05 avatar Mar 20 '19 18:03 Shwetap05

Any updates?

ghost avatar Apr 02 '19 22:04 ghost

I will have a PR out sometime over weekend. Though do not have an ETA on integration to task yet. But as soon as changes are in the library we will start work on updating the Task to consume the changes.

Shwetap05 avatar Apr 04 '19 22:04 Shwetap05

Hitting this same issue as well.

prafullbhosale avatar Apr 25 '19 21:04 prafullbhosale

PR is out for the fix https://github.com/microsoft/OpenAPI.NET.CSharpAnnotations/pull/208

Shwetap05 avatar May 09 '19 23:05 Shwetap05

I can see that the above PR is merged. Is this issue resolved?. I am still facing this issue

ShubhamRane avatar Jul 06 '20 12:07 ShubhamRane