Description
Hi,
I have a bug in my demo when I use SwaggerODataSample(aspnetcore),and I do not know how to do with the DI of my new project DataAccessSample into startup.cs.
### The log is:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.AspNet.OData.TypeExtensions.<>c__DisplayClass23_0.b__0(IEdmStructuredType t) in C:\Users\Fusionshen\Downloads\aspnet-api-versioning\src\Common.OData.ApiExplorer\AspNet.OData\TypeExtensions.cs:line 137
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable1 source, Func
2 predicate, Boolean& found)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func
2 predicate)
at Microsoft.AspNet.OData.TypeExtensions.GetStructuredType(Type type, IEdmModel model, IEnumerable1 assemblies) in C:\Users\Fusionshen\Downloads\aspnet-api-versioning\src\Common.OData.ApiExplorer\AspNet.OData\TypeExtensions.cs:line 137 at Microsoft.AspNet.OData.TypeExtensions.SubstituteIfNecessary(Type type, IServiceProvider serviceProvider, IEnumerable
1 assemblies, ModelTypeBuilder modelTypeBuilder) in C:\Users\Fusionshen\Downloads\aspnet-api-versioning\src\Common.OData.ApiExplorer\AspNet.OData\TypeExtensions.cs:line 53
at Microsoft.AspNetCore.Mvc.ApiExplorer.ODataApiDescriptionProvider.GetApiResponseTypes(IReadOnlyList1 responseMetadataAttributes, Type responseType, IServiceProvider serviceProvider) in C:\Users\Fusionshen\Downloads\aspnet-api-versioning\src\Microsoft.AspNetCore.OData.Versioning.ApiExplorer\AspNetCore.Mvc.ApiExplorer\ODataApiDescriptionProvider.cs:line 556 at Microsoft.AspNetCore.Mvc.ApiExplorer.ODataApiDescriptionProvider.<NewODataApiDescriptions>d__33.MoveNext() in C:\Users\Fusionshen\Downloads\aspnet-api-versioning\src\Microsoft.AspNetCore.OData.Versioning.ApiExplorer\AspNetCore.Mvc.ApiExplorer\ODataApiDescriptionProvider.cs:line 324 at Microsoft.AspNetCore.Mvc.ApiExplorer.ODataApiDescriptionProvider.OnProvidersExecuted(ApiDescriptionProviderContext context) in C:\Users\Fusionshen\Downloads\aspnet-api-versioning\src\Microsoft.AspNetCore.OData.Versioning.ApiExplorer\AspNetCore.Mvc.ApiExplorer\ODataApiDescriptionProvider.cs:line 172 at Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescriptionGroupCollectionProvider.GetCollection(ActionDescriptorCollection actionDescriptors) at Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescriptionGroupCollectionProvider.get_ApiDescriptionGroups() at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath, String[] schemes) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.<Invoke>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame
1.d__2.MoveNext()
### The bug location:
It seems that the DI of my new project DataAccessSample is not ok.
what can I do?
Regards