Tonka Crash

Request for Notification of Broken Mods

Recommended Posts

We already have get messages about out of date mods from MiniAVC & KSP-AVC, but we really need one for broken mods. I'd suggested adding this to the AVC mods in the KSP-AVC thread, since almost every mod user will have it due to MiniAVC being bundled with lots of mods, but @linuxgurugamer suggested a new mod, so here's the thread. The only problem I see with a new mod is getting users to install it if it isn't bundled with something everyone has like ModuleManager or AVC.

With 1.7 some popular mods have been broken due to .dlls not loading. This isn't at all apparent to a lot of users and the forum threads start to fill with questions about all sorts of symptoms resulting from missing .dlls. (animations broken, PAW menus missing, other mods misbehaving). Lots of players either don't bother looking or don't understand the logs the game creates. I'm requesting a mod to run a scan on the KSP.Log at the start to look for a specific failure and display a message to the user.

The messages below are from my logs for the latest versions of KAS and KPBS in 1.7, they points to exactly which routine in the mod has the problem for troubleshooting, but the important thing for the user are the message AssemblyLoader: Exception loading 'KAS'  Right there is enough to tell me there's a serious problem with KAS.  

A popup message telling the user "Exception detected loading KAS, the associated mod is broken. Please go to the mod's forum thread for more information" should be enough to clue a user in that there are problems. The only real problem I see is that it's not always easy for a clueless user to identify which mod includes the .dll throwing the error  as in the case of KPBS that has the .dll name PlanetarySurfaceStructures

KSP.Log Version:

[ERR 07:44:08.780] AssemblyLoader: Exception loading 'KAS': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadAssemblies () [0x00000] in <filename unknown>:0 
Additional information about this exception:

 System.TypeLoadException: Could not load type 'SaveUpgradePipeline.KAS.PatchFilesProcessor' from assembly 'KAS, Version=1.2.7037.1765, Culture=neutral, PublicKeyToken=null'.

[ERR 07:44:08.813] AssemblyLoader: Exception loading 'PlanetarySurfaceStructures': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadAssemblies () [0x00000] in <filename unknown>:0 
+Additional information about this exception:

 System.TypeLoadException: Could not load type 'PlanetarySurfaceStructures.SaveFileUpgrader' from assembly 'PlanetarySurfaceStructures, Version=1.6.8.0, Culture=neutral, PublicKeyToken=null'.

output_log.txt Version:

AssemblyLoader: Exception loading 'KAS': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadAssemblies () [0x00000] in <filename unknown>:0 

Additional information about this exception:

 System.TypeLoadException: Could not load type 'SaveUpgradePipeline.KAS.PatchFilesProcessor' from assembly 'KAS, Version=1.2.7037.1765, Culture=neutral, PublicKeyToken=null'.
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

    
Non platform assembly: C:\Games\Kerbal Space Program\GameData\PlanetaryBaseInc\BaseSystem\Plugins\PlanetarySurfaceStructures.dll (this message is harmless)
AssemblyLoader: Exception loading 'PlanetarySurfaceStructures': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadAssemblies () [0x00000] in <filename unknown>:0 

Additional information about this exception:

 System.TypeLoadException: Could not load type 'PlanetarySurfaceStructures.SaveFileUpgrader' from assembly 'PlanetarySurfaceStructures, Version=1.6.8.0, Culture=neutral, PublicKeyToken=null'.
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

 

Share this post


Link to post
Share on other sites

I like, and rather have this as part of an existing, widely used mod instead of having yet another mod (like you).

 

In fact - so many mods could be married together.... would be nice.

Share this post


Link to post
Share on other sites

@Tonka Crash

It sounds like you have a good handle on what you'd like to see.  I look forward to see how you progress on this.  Good luck.

Share this post


Link to post
Share on other sites
8 minutes ago, goldenpsp said:

@Tonka Crash

It sounds like you have a good handle on what you'd like to see.  I look forward to see how you progress on this.  Good luck.

I don't really have the skill set to write it myself. I'm decent at debugging complex systems I've never seen before; it's basically my day job. But, my C# experience is very limited and my knowledge of the KSP API is non-existent.

Share this post


Link to post
Share on other sites
23 minutes ago, Tonka Crash said:

I don't really have the skill set to write it myself. I'm decent at debugging complex systems I've never seen before; it's basically my day job. But, my C# experience is very limited and my knowledge of the KSP API is non-existent.

You've been here a bit.  You have probably seen how these mod request threads go.

The basic situation is there are very few modders sitting around going "man I'd love to dedicate some of my free time to write a mod, if only I had an idea"  @linuxgurugamer may be the exception, but I'm beginning to believe he is actually a partially sentient AI supercomputer.  And even he has limits.

There are many modders here who started with an idea that they wanted to see in game.  They had little to no C# knowledge.  No knowledge of the API.  And yet they made a mod because they just really wanted to see their idea in game.

 

If you want to see this idea become reality, mostly likely you'll have to write it.

Share this post


Link to post
Share on other sites
Posted (edited)

I don't think what you want is technically possible.

The first chance a mod gets to run is on the loading screen - at that point the assemblies are already loaded (or not). The only way I can think of to tell if an assembly has failed to load (without literally looking for every KSP assembly ever by Reflection, which is not going to happen), is to parse KSP.log looking for the lines you are talking about.

This isn't possible because KSP is locking KSP.log - and even if it was it would be very slow.

Also, just to address the below: Just do your research. When I wrote Monthly Budgets I literally had no idea what I was doing. I searched around the internet, found some resources, and taught myself as I went along.

KSP also has the great advantage that everything is open source, so you can look at what other modders have done.

If you're looking for a place to start I recommend this website: https://learncs.org/

8 hours ago, Tonka Crash said:

I don't really have the skill set to write it myself. I'm decent at debugging complex systems I've never seen before; it's basically my day job. But, my C# experience is very limited and my knowledge of the KSP API is non-existent. 

Edited by severedsolo

Share this post


Link to post
Share on other sites
Posted (edited)

This sounds similar to another mod in some ways:

The source might give you some clues about how to approach it:
https://github.com/SlimJimDodger/ExceptionDetectorUpdated

2 hours ago, severedsolo said:

This isn't possible because KSP is locking KSP.log - and even if it was it would be very slow.

I'm seeing suggestions online that you might be able to copy an exclusively locked file to another location (haven't tried it myself) and then work with the copy. Obviously that would be even slower if KSP.log is large, but if reading that text was an absolute necessity, it might be worth investigating.

Edited by HebaruSan

Share this post


Link to post
Share on other sites
Posted (edited)
2 hours ago, HebaruSan said:

I'm seeing suggestions online that you might be able to copy an exclusively locked file to another location (haven't tried it myself) and then work with the copy.

That's what you get for assuming XD - You are correct, File.Copy will indeed copy a locked KSP.log. It's not actually that slow to parse it either as the log is pretty small at the point of the loading screen.

I take back what i said about it being technically impossible, it is indeed possible. I have a working prototype.

Edited by severedsolo

Share this post


Link to post
Share on other sites
On 4/22/2019 at 9:21 AM, severedsolo said:

That's what you get for assuming XD - You are correct, File.Copy will indeed copy a locked KSP.log. It's not actually that slow to parse it either as the log is pretty small at the point of the loading screen.

I take back what i said about it being technically impossible, it is indeed possible. I have a working prototype.

How is this going, are you going to be continuing or not?  No, I'm not thinking about implementing this, but would love to have it available

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now