I am trying to implement a custom ISerializer (CustomSerializer class) to accommodate a different format of the JSON file on disk. I added the following code to my ConfigureServices method to attempt to register my custom serializer.
When trying to access my model I get a NullReferenceException like the below stack trace. I'm sure I'm missing something in the registration of the CustomSerializer because the break points in my CustomSerializer class are never hit and the DefaultStoreManager.Initialize method throwing the exception attempts to retrieve the ISerializer from the IServiceProvider.
Any help would be much appreciated.
NullReferenceException: Object reference not set to an instance of an object.
FileContextCore.StoreManager.DefaultStoreManager.Initialize(IFileContextScopedOptions options, IEntityType entityType, object keyValueFactory)
FileContextCore.Storage.Internal.FileContextTable<TKey>.Init()
FileContextCore.Storage.Internal.FileContextTable<TKey>..ctor(IPrincipalKeyValueFactory<TKey> keyValueFactory, bool sensitiveLoggingEnabled, IEntityType entityType, IFileContextScopedOptions options, IServiceProvider serviceProvider)
FileContextCore.Storage.Internal.FileContextTableFactory+<>c__DisplayClass7_0<TKey>.<CreateFactory>b__0()
FileContextCore.Storage.Internal.FileContextTableFactory.Create(IEntityType entityType)
FileContextCore.Storage.Internal.FileContextStore.EnsureTable(object key, IEntityType entityType)
FileContextCore.Storage.Internal.FileContextStore.GetTables(IEntityType entityType)
FileContextCore.Query.Internal.FileContextShapedQueryCompilingExpressionVisitor.Table(QueryContext queryContext, IEntityType entityType)
lambda_method(Closure , QueryContext )
Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync<TResult>(Expression query, CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync<TResult>(Expression expression, CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable<TResult>.GetAsyncEnumerator(CancellationToken cancellationToken)
Microsoft.EntityFrameworkCore.Internal.InternalDbSet<TEntity>.System.Collections.Generic.IAsyncEnumerable<TEntity>.GetAsyncEnumerator(CancellationToken cancellationToken)
System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T>.GetAsyncEnumerator()
Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync<TSource>(IQueryable<TSource> source, CancellationToken cancellationToken)
GroceryStoreAPI.Controllers.CustomerController.GetCustomers() in CustomerController.cs
return await _context.Customers.ToListAsync();
lambda_method(Closure , object )
Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable+Awaiter.GetResult()
Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)
System.Threading.Tasks.ValueTask<TResult>.get_Result()
System.Runtime.CompilerServices.ValueTaskAwaiter<TResult>.GetResult()
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask<IActionResult> actionResultValueTask)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)