Skip to content

MongoDB WebAPI Example does not workΒ #35484

@xBaaDf00d

Description

@xBaaDf00d

Triaged: Task:
Check both the .NET 8 and .NET 9 version of this topic to see if the original issue description below is related to a mismatch issue between expected .NET target mismatched with the topic version selected for .NET 9. The instructions do differ.

[Original issue description below:]

Description

Following these instructions led to I am running dot net 8 on my Mac.

###
System.NotSupportedException: JsonTypeInfo metadata for type 'System.Collections.Generic.List1[BookStore.Models.BookModel]' was not provided by TypeInfoResolver of type '[]'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically. at System.Text.Json.ThrowHelper.ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver resolver) at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
at System.Text.Json.JsonSerializerOptions.GetTypeInfo(Type type)
at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|22_0(ResourceInvoker invoker, IActionResult result)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
###
When attempting, to test. Its as though the BSon Serializer Fails to serialise out the list of modes on the Get call, Fails at this level it wont get anywhere

@Copilot: Read the complete issue discussion including all comments from maintainers and contributors before proposing solutions. Further analysis and discussions in the Issue discussion may reveal the actual root cause differs from the initial symptom description, or clues to a better approach and plan of action. Indicate you have done so.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mongo-app?view=aspnetcore-9.0&tabs=visual-studio

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/tutorials/first-mongo-app.md

Document ID

83a5cb3b-23bc-4f0c-cd1c-1d1ffeb1131a

Platform Id

65f2481a-2462-7f68-0aa8-570bd4557d09

Article author

@wadepickett

Metadata

  • ID: 5240866d-d0a1-f0dd-7b2c-203e1d69bc4b
  • PlatformId: 65f2481a-2462-7f68-0aa8-570bd4557d09
  • Service: aspnet-core
  • Sub-service: tutorials

Related Issues


Associated WorkItem - 490204

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions