[SOLVED] NullReferenceException with basic mod from BUTR Mod Template

Users who are viewing this thread

Adobandito

Recruit
Howdy all - I'm setting up my environment to do a little modding. I've followed along with Lesser Scholar's tutorial (thanks for that - it's awesome!) and used the BUTR/Bannerlord.Module.Template to create a basic mod scaffold to test the debugger, etc. I'm able to run the mod from visual studio 2022 which loads Bannerlord. It's all very cool! I'm just trying to test that everything is set up correctly. I haven't added any code to the mod yet; it only contains what is generated from running "dotnet new blmodfx --name FirstMod" from the command line.

When I launch from visual studio and then try to save after starting a new campaign, I get a System.NullReferenceException in Visual Studio. If I hit continue, the game crashes. The top of the call stack says: TaleWorlds.Core.dll!TaleWorlds.Core.MBSaveLoad.GetSaveMetaData.AnonymousMethod__41_0(TaleWorlds.ModuleManager.ModuleInfo q)

I also get a System.NullReferenceException as soon as I select "Saved Games" or "Continue Campaign" from the main menu. The top of the call stack says: SandBox.ViewModelCollection.dll!SandBox.ViewModelCollection.SaveLoad.SaveLoadVM.IsAnyModuleMissingFromSaveOrCurrentModules.AnonymousMethod__0(TaleWorlds.ModuleManager.ModuleInfo loadedModule).

I see the mod being deployed. I'll add a little "hello world" and see if the mod is running and if it's maybe just a debugger issue or something.

I apologize if this is already asked and answered elsewhere. I searched around but didn't find an answer.

Any thoughts on what might be causing the exceptions and how to fix? TIA!!
 
I just noticed that Harmony was listed as a dependency which I'm not currently using. I removed references from the SubModule.xml but still the same problem.

I've confirmed that the mod is working and can use it whether debugging or just deploying and then running the game without attaching VS. I just can't save or load games when attached to VS.
 
Upvote 0
Back
Top Bottom