Skip to content

NullReferenceException when executing codegen write command #3

@luber

Description

@luber

I have asp.net 8 project with next lines in Progam.cs:

if (args.Contains("codegen"))
{
    return await defaultHostBuilder.RunOaktonCommands(args);
}

When I start the app with next command args: dotnet MyApp.dll codegen write -
I can see that code was generated but at the end the process fails with next exception:

ERROR: System.NullReferenceException: Object reference not set to an instance of an object.
  at async ValueTask Marten.Events.EventGraph.DisposeAsync()                                                
  at async ValueTask Autofac.Core.Disposer.DisposeAsync(bool disposing)                                     
  at async ValueTask Autofac.Core.Lifetime.LifetimeScope.DisposeAsync(bool disposing)                       
  at async ValueTask Autofac.Core.Container.DisposeAsync(bool disposing)                                    
  at async ValueTask Autofac.Extensions.DependencyInjection.AutofacServiceProvider.DisposeAsync()           
  at async ValueTask Microsoft.Extensions.Hosting.Internal.Host.<DisposeAsync>g__DisposeAsync|21_0(object o)
  at async ValueTask Microsoft.Extensions.Hosting.Internal.Host.DisposeAsync()                              
  at void Microsoft.Extensions.Hosting.Internal.Host.Dispose()                                              
  at bool JasperFx.CodeGeneration.Commands.GenerateCodeCommand.Execute(GenerateCodeInput input)             
  at Task<bool> Oakton.OaktonCommand`1.Oakton.IOaktonCommand.Execute(object input)                          
  at Task<bool> Oakton.CommandRun.Execute()                                                                 
  at async Task<int> Oakton.CommandExecutor.execute(CommandRun run)                                         

Process finished with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions