NSwag
NSwag copied to clipboard
.NET 8 - Newtonsoft.Json.JsonSerializationException: Error setting value to 'SelectedSwaggerGeneratorRaw' on 'NSwag.Commands.NSwagDocument'.
This bug seem similar to this, however I'm seeing this after upgrading from .NET 6 to .NET 8: https://github.com/RicoSuter/NSwag/issues/1576
Reproduce on a fresh API with no changes except nswag.json and adding nswag packages of 14.0.0-preview012. See this repository for a reproduce: https://github.com/jepperaskdk/nswagdotnet8
> dotnet "C:\Users\USER\.nuget\packages\nswag.msbuild\14.0.0-preview012\buildTransitive\../tools/Net80/dotnet-nswag.dll" run nswag.json
NSwag command line tool for .NET Core Net80, toolchain v14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\Jeppe\.nuget\packages\nswag.msbuild\14.0.0-preview012\tools\Net80
Executing file 'nswag.json' with variables ''...
Newtonsoft.Json.JsonSerializationException: Error setting value to 'SelectedSwaggerGeneratorRaw' on 'NSwag.Commands.NSwagDocument'.
---> System.NullReferenceException: Object reference not set to an instance of an object.
at NSwag.Commands.NSwagDocumentBase.set_SelectedSwaggerGeneratorRaw(JObject value) in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 88
at Newtonsoft.Json.Serialization.ExpressionValueProvider.SetValue(Object target, Object value)
--- End of inner exception stack trace ---