© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•5mo ago•
1 reply
Olsson

Module initializer only running for one assembly

Hi,

I have source generator to generate compiled meta data about classes, to register these for a scripting layer in C++. These are stored as a module initializer, but the module initializer won't run when I load assembly

    [System.Runtime.CompilerServices.ModuleInitializer]
    public static void Register() => StartUpJobManager.RegisterStartUpJob(typeof(ManagedCropoutSampleProject.Interactable.FResourceInfo).Assembly.GetName().Name!, Initialize);
    [System.Runtime.CompilerServices.ModuleInitializer]
    public static void Register() => StartUpJobManager.RegisterStartUpJob(typeof(ManagedCropoutSampleProject.Interactable.FResourceInfo).Assembly.GetName().Name!, Initialize);
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

The type initializer for '<Module>' threw an exception.
C#CC# / help
2y ago
❔ Error. Array initializer can only be used in a variable or field initializer.
C#CC# / help
4y ago
Very specific question about AssemblyLoadContext and Assembly Resolution
C#CC# / help
3y ago
❔ Null class auto initializer
C#CC# / help
4y ago