-
Notifications
You must be signed in to change notification settings - Fork 22
Allow loading of mods with unloadable types #83
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't say I really understand the implications of this change, though the code seems good enough, so leaving it at least for a while others to comment & approve if they understand it better...
NeosModLoader/AssemblyHider.cs
Outdated
|
||
private static bool IsModType(Type type) | ||
{ | ||
return IsModAssembly(type.Assembly, "type", type.ToString(), true, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also quite a few parameters, which starts getting a bit messy keeping track of which one is which, would probably be clearer if named params are a available in net472? Or alternatively could change the input type to be an object, but iirc that wasn't as convenient in .NET...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've named the bools and added some more method docs in f24d079
... and also fixed a blunder in some of my boolean algebra
Oh yeah. The fact that I'm patching You might be wondering why I didn't just patch the Neos methods that were calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short story: this fixes New-Project-Final-Final-WIP/HeadlessTweaks#4.
Long story: It turns out some mods have types that cannot be loaded at runtime, because assemblies they depend on are in turn not loaded. .NET really doesn't like if you try to inspect those types with reflection, which both NML and Neos try to do. Two things were done to fix this:
AppDomain.CurrentDomain.GetAssemblies()
we intercept that and filter out mod assembliesWith these fixes in place I've confirmed that HeadlessTweaks no longer crashes on Windows headless.