KSP-ModularManagement / KSPe

Extensions and utilities for Kerbal Space Program
http://ksp.lisias.net/add-ons/KSPAPIExtensions
Other
11 stars 5 forks source link

problem regarding KSPIE (interstellar extended) compatibility after 2.4.6.3 update #26

Closed tonimark closed 1 year ago

tonimark commented 2 years ago

after update from 2.4.6.2=>2.4.6.3, this message showed up regarding broken KSPI compatibility problem I tried replacing the tweak scale folder both with the newest versions of KSPIE and tweak scale with no change

Lisias commented 2 years ago

Hi, @tonimark !

This is not a problem on TweakScale, it's a KSP bug being triggered by a mishap on the installment that it's affecting TweakScale, and so TweakScale is the one yelling about.

What's happening is that there's a very nasty bug on KSP since 1.8.0 where, if by any reason, a DLL borks due a faulty or missing dependency, everything else trying to load after will bork too no matter the dependencies are met or not.

You need to inspect your KSP.log looking for the first occurrence of the System.Reflection.ReflectionTypeLoadException exception, as this is the one that triggered the KSP bug (you will find a lot, but all of them after the first one are bogus, is the KSP bug acting).

I wrote a full essay about the subject on Forum here.

Alternatively, you can attach your KSP.log here on a comment so I can inspect it and detect the problem for you.

Cheers!

MgnfcntBstrd commented 2 years ago

Hi there!

I manually updated TweakScale to 2.4.6.3 just a bit ago, and I got the same GUI error on load. I don't currently run KSPIE (though I used to). I'm not blaming TweakScale, I just thought if there WAS a problem with this build, I should report it.

I closed the game the first time the errors popped up, hit the "unblock" checkbox on the downloaded Zip, and updated it again, thinking that perhaps Windows was blocking the DLLs. I've got a lot of mods on my machine, four were updated today by CKAN, and a new one was added today as well. I continued on when the warning popped up even after the uninstall, loaded the game, entered the VAB and was basically unable to do anything there; the console was spamming exceptions.

KSP - Copy.zip

I searched the log for that exception above, but I didn't get any hits. Here are some excerpts:

[ERR 15:25:14.820] Exception handling event onGUIApplicationLauncherReady in class ToolbarSupport:System.TypeInitializationException: The type initializer for 'TweakScale.GUI.Icons' threw an exception. ---> System.TypeInitializationException: The type initializer for 'KSPe.IO.Hierarchy`1' threw an exception. ---> System.TypeInitializationException: The type initializer for 'KSPe.IO.Hierarchy' threw an exception. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified.

at KSPe.Multiplatform.LowLevelTools.Windows32.GetFinalPathName (System.String path) [0x0002b] in :0 at KSPe.Multiplatform.FileSystem.Reparse_windows (System.String path) [0x00000] in :0 at KSPe.Multiplatform.FileSystem.ReparsePath (System.String path) [0x00015] in :0 at KSPe.IO.Directory.RealPath (System.String path) [0x0001f] in :0 at KSPe.IO.Directory.Exists (System.String path) [0x00000] in :0 at KSPe.IO.Path.EnsureTrailingSeparatorOnDir (System.String path, System.Boolean blindlyAppend) [0x00033] in :0 at KSPe.IO.Path.Combine (System.String path1, System.String path2) [0x00007] in :0 at KSPe.IO.Hierarchy..cctor () [0x00041] in :0 --- End of inner exception stack trace --- --- End of inner exception stack trace --- --- End of inner exception stack trace --- at EventVoid.Fire () [0x00127] in :0

[EXC 15:25:14.821] Win32Exception: The system cannot find the file specified.

KSPe.Multiplatform.LowLevelTools.Windows32.GetFinalPathName (System.String path) (at <f267864bc5b14efd9db6b3cdd8146f53>:0)
KSPe.Multiplatform.FileSystem.Reparse_windows (System.String path) (at <f267864bc5b14efd9db6b3cdd8146f53>:0)
KSPe.Multiplatform.FileSystem.ReparsePath (System.String path) (at <f267864bc5b14efd9db6b3cdd8146f53>:0)
KSPe.IO.Directory.RealPath (System.String path) (at <f267864bc5b14efd9db6b3cdd8146f53>:0)
KSPe.IO.Directory.Exists (System.String path) (at <f267864bc5b14efd9db6b3cdd8146f53>:0)
KSPe.IO.Path.EnsureTrailingSeparatorOnDir (System.String path, System.Boolean blindlyAppend) (at <f267864bc5b14efd9db6b3cdd8146f53>:0)
KSPe.IO.Path.Combine (System.String path1, System.String path2) (at <f267864bc5b14efd9db6b3cdd8146f53>:0)
KSPe.IO.Hierarchy..cctor () (at <f267864bc5b14efd9db6b3cdd8146f53>:0)
Rethrow as TypeInitializationException: The type initializer for 'KSPe.IO.Hierarchy' threw an exception.
Rethrow as TypeInitializationException: The type initializer for 'KSPe.IO.Hierarchy`1' threw an exception.
Rethrow as TypeInitializationException: The type initializer for 'TweakScale.GUI.Icons' threw an exception.
EventVoid.Fire () (at <cd473063d3a2482f8d93d388d0c95035>:0)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
EventVoid:Fire()
KSP.UI.Screens.ApplicationLauncher:StartupSequence()
KSP.UI.Screens.ApplicationLauncher:OnSceneLoadedGUIReady(GameScenes)
EventData`1:Fire(GameScenes)
<FireLoadedEventGUIReady>d__47:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

[LOG 15:25:14.823] ScaleModList: listSize 164 maxListSize 1444

[LOG 15:25:34.365] [SystemHeat][SystemHeatOverlay]: Editor Reset [LOG 15:25:34.365] [SystemHeat][SystemHeatOverlay]: Cleared all panels [LOG 15:25:34.397] [MechJeb2] Loading Mechjeb 2.12.3 [EXC 15:25:34.834] DllNotFoundException: An Add'On Support DLL was not loaded. Missing type : TweakScale.PartDB.StandardPartScaler KSPe.Util.SystemTools+TypeFinder.FindByQualifiedName (System.String qn) (at :0) TweakScale.PartDB.Scaler.FindAndCreate (System.String name, Part prefab, Part part, TweakScale.ScaleType scaleType, TweakScale.TweakScale ts) (at <45182d9103c649a9b01afeb7178d397a>:0) TweakScale.PartDB.Scaler.Create (Part prefab, Part part, TweakScale.ScaleType scaleType, TweakScale.TweakScale ts) (at <45182d9103c649a9b01afeb7178d397a>:0) TweakScale.TweakScale.Setup (Part part) (at <45182d9103c649a9b01afeb7178d397a>:0) TweakScale.TweakScale.OnAwake () (at <45182d9103c649a9b01afeb7178d397a>:0) PartModule.Awake () (at :0) UnityEngine.DebugLogHandler:LogException(Exception, Object) ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object) UnityEngine.GameObject:SetActive(Boolean) ShipConstruct:LoadShip(ConfigNode, UInt32, Boolean, String&) ShipConstruct:LoadShip(ConfigNode, UInt32) ShipConstruct:LoadShip(ConfigNode) ShipConstruction:LoadShip() EditorLogic:StartEditor(Boolean) EditorLogic:ShipToLoadSelected(ConfigNode, LoadType) KSP.UI.Screens.CraftBrowserDialog:onPipelineFinished(ConfigNode, CraftEntry, LoadType) KSP.UI.Screens.<>cDisplayClass153_0:b0(ConfigNode) KSPUpgradePipeline:Process(ConfigNode, String, LoadContext, Callback1, Callback2) KSP.UI.Screens.CraftBrowserDialog:pipeSelectedItem(CraftEntry, LoadType) KSP.UI.Screens.CraftBrowserDialog:ConfirmLoadCraft() KSP.UI.Screens.CraftBrowserDialog:onButtonLoad() UnityEngine.EventSystems.EventSystem:Update() [WRN 15:25:34.835] [Part]: PartModule indexing mismatch at bluedog.Apollo.Block2.ParachuteMount, index 2. Node 'CollisionFX' found in loaded data, but 'TweakScale' is defined in prefab. Looking for CollisionFX in other indices... [WRN 15:25:34.835] ...CollisionFX module found at index 3. [WRN 15:25:34.835] [Part]: PartModule indexing mismatch at bluedog.Apollo.Block2.ParachuteMount, index 3. Node 'ShipEffectsCollisions' found in loaded data, but 'CollisionFX' is defined in prefab. Looking for ShipEffectsCollisions in other indices... [WRN 15:25:34.835] ...ShipEffectsCollisions module found at index 4. [EXC 15:25:34.877] DllNotFoundException: An Add'On Support DLL was not loaded. Missing type : TweakScale.PartDB.StandardPartScaler KSPe.Util.SystemTools+TypeFinder.FindByQualifiedName (System.String qn) (at :0) TweakScale.PartDB.Scaler.FindAndCreate (System.String name, Part prefab, Part part, TweakScale.ScaleType scaleType, TweakScale.TweakScale ts) (at <45182d9103c649a9b01afeb7178d397a>:0) TweakScale.PartDB.Scaler.Create (Part prefab, Part part, TweakScale.ScaleType scaleType, TweakScale.TweakScale ts) (at <45182d9103c649a9b01afeb7178d397a>:0) TweakScale.TweakScale.Setup (Part part) (at <45182d9103c649a9b01afeb7178d397a>:0) TweakScale.TweakScale.OnAwake () (at <45182d9103c649a9b01afeb7178d397a>:0) PartModule.Awake () (at :0) UnityEngine.DebugLogHandler:LogException(Exception, Object) ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object) UnityEngine.GameObject:SetActive(Boolean) ShipConstruct:LoadShip(ConfigNode, UInt32, Boolean, String&) ShipConstruct:LoadShip(ConfigNode, UInt32) ShipConstruct:LoadShip(ConfigNode) ShipConstruction:LoadShip() EditorLogic:StartEditor(Boolean) EditorLogic:ShipToLoadSelected(ConfigNode, LoadType) KSP.UI.Screens.CraftBrowserDialog:onPipelineFinished(ConfigNode, CraftEntry, LoadType) KSP.UI.Screens.<>cDisplayClass153_0:b0(ConfigNode) KSPUpgradePipeline:Process(ConfigNode, String, LoadContext, Callback1, Callback2) KSP.UI.Screens.CraftBrowserDialog:pipeSelectedItem(CraftEntry, LoadType) KSP.UI.Screens.CraftBrowserDialog:ConfirmLoadCraft() KSP.UI.Screens.CraftBrowserDialog:onButtonLoad() UnityEngine.EventSystems.EventSystem:Update() [WRN 15:25:34.878] [Part]: PartModule indexing mismatch at bluedog.Apollo.Block2.Parachute, index 4. Node 'CollisionFX' found in loaded data, but 'TweakScale' is defined in prefab. Looking for CollisionFX in other indices...

MgnfcntBstrd commented 2 years ago

FYI, I rolled TS back to an earlier one, no issues on load or going into the VAB. Attached the log for comparison (since all the rest of my shipwreck of mods are still there), if you're interested.

KSP.log

Lisias commented 2 years ago

Found the problem on the KSP.log

[LOG 15:08:05.240] [TweakScale] ERROR: System.TypeInitializationException: The type initializer for 'KSPe.IO.Hierarchy`1' threw an exception. ---> System.TypeInitializationException: The type initializer for 'KSPe.IO.Hierarchy' threw an exception. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified.

  at KSPe.Multiplatform.LowLevelTools.Windows32.GetFinalPathName (System.String path) [0x0002b] in <f267864bc5b14efd9db6b3cdd8146f53>:0
  at KSPe.Multiplatform.FileSystem.Reparse_windows (System.String path) [0x00000] in <f267864bc5b14efd9db6b3cdd8146f53>:0
  at KSPe.Multiplatform.FileSystem.ReparsePath (System.String path) [0x00015] in <f267864bc5b14efd9db6b3cdd8146f53>:0
  at KSPe.IO.Directory.RealPath (System.String path) [0x0001f] in <f267864bc5b14efd9db6b3cdd8146f53>:0
  at KSPe.IO.Directory.Exists (System.String path) [0x00000] in <f267864bc5b14efd9db6b3cdd8146f53>:0
  at KSPe.IO.Path.EnsureTrailingSeparatorOnDir (System.String path, System.Boolean blindlyAppend) [0x00033] in <f267864bc5b14efd9db6b3cdd8146f53>:0
  at KSPe.IO.Path.Combine (System.String path1, System.String path2) [0x00007] in <f267864bc5b14efd9db6b3cdd8146f53>:0
  at KSPe.IO.Hierarchy..cctor () [0x00041] in <f267864bc5b14efd9db6b3cdd8146f53>:0
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at KSPe.Util.SystemTools+Assembly+Loader`1[T].TryPath (System.String path, System.String[] subdirs) [0x00000] in <f267864bc5b14efd9db6b3cdd8146f53>:0
  at KSPe.Util.SystemTools+Assembly+Loader`1[T]..ctor (System.String[] subdirs) [0x0002e] in <f267864bc5b14efd9db6b3cdd8146f53>:0
  at TweakScale.Startup.Start () [0x00018] in <45182d9103c649a9b01afeb7178d397a>:0  at error:0
[ERR 15:08:05.241] Unable to use a named GUIStyle without a current skin. Most likely you need to move your GUIStyle initialization code to OnGUI

This is Windows screwing up. Again.

You need to follow instructions on this page:

https://social.technet.microsoft.com/Forums/windows/en-US/03796fec-e86a-4988-80bf-2bbb9bc4a89b/kernel32dll-is-not-getting-fixed?forum=w7itproinstall

To restore the Kernel32.dll on your rig.

I'm using this thing for a reason, I need to undo MS bulshit did while starting up the .NET runtime, otherwise no integrity check is possible. So that code above, that needs Kernal32.dll to be functional.

You will be stuck on older versions of TweakScale forever otherwise.

MgnfcntBstrd commented 2 years ago

There's nothing wrong with my kernel32.dll... but you're not going to find it where you're looking...

[image: image.png] image

On Tue, Nov 23, 2021 at 11:15 AM Lisias @.***> wrote:

Found the problem on the KSP.log

[LOG 15:08:05.240] [TweakScale] ERROR: System.TypeInitializationException: The type initializer for 'KSPe.IO.Hierarchy`1' threw an exception. ---> System.TypeInitializationException: The type initializer for 'KSPe.IO.Hierarchy' threw an exception. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified.

at KSPe.Multiplatform.LowLevelTools.Windows32.GetFinalPathName (System.String path) [0x0002b] in :0 at KSPe.Multiplatform.FileSystem.Reparse_windows (System.String path) [0x00000] in :0 at KSPe.Multiplatform.FileSystem.ReparsePath (System.String path) [0x00015] in :0 at KSPe.IO.Directory.RealPath (System.String path) [0x0001f] in :0 at KSPe.IO.Directory.Exists (System.String path) [0x00000] in :0 at KSPe.IO.Path.EnsureTrailingSeparatorOnDir (System.String path, System.Boolean blindlyAppend) [0x00033] in :0 at KSPe.IO.Path.Combine (System.String path1, System.String path2) [0x00007] in :0 at KSPe.IO.Hierarchy..cctor () [0x00041] in :0 --- End of inner exception stack trace --- --- End of inner exception stack trace --- at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr) at KSPe.Util.SystemTools+Assembly+Loader1[T].TryPath (System.String path, System.String[] subdirs) [0x00000] in <f267864bc5b14efd9db6b3cdd8146f53>:0 at KSPe.Util.SystemTools+Assembly+Loader1[T]..ctor (System.String[] subdirs) [0x0002e] in :0 at TweakScale.Startup.Start () [0x00018] in <45182d9103c649a9b01afeb7178d397a>:0 at error:0 [ERR 15:08:05.241] Unable to use a named GUIStyle without a current skin. Most likely you need to move your GUIStyle initialization code to OnGUI

This is Windows screwing up. Again.

You need to follow instructions on this page:

https://social.technet.microsoft.com/Forums/windows/en-US/03796fec-e86a-4988-80bf-2bbb9bc4a89b/kernel32dll-is-not-getting-fixed?forum=w7itproinstall

To restore the Kernel32.dll on your rig.

I'm using this thing for a reason, I need to undo MS bulshit did while starting up the .NET runtime, otherwise no integrity check is possible. So that code above, that needs Kernal32.dll to be functional.

You will be stuck on older versions of TweakScale forever otherwise.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/net-lisias-ksp/TweakScale/issues/214#issuecomment-976873260, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWS5SJ3QGG7HPV7IO353QTTUNPD3ZANCNFSM5IN2G5QQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Lisias commented 2 years ago

Thanks for the heads up, @MgnfcntBstrd .

I do not try to load it myself, I "ask" Mono for looking into it and it does this search on may places until it find one - this is one of the terrible decision made by Microsoft in the part that is still plaguing nowadays.

The place for this DLL, as far as I know, is c:\Windows\System32 - but it's not enough for it to be there, it should be also registered on the REGSVR thingy.

I have found some allegations that misbehaving GPU device driver installers are responsible for this problem (why 3rd parties are allowed to screw up a system library is something I always had despised on Windows).

So, in a nutshell, if the mono runtime is not finding Kernel32.dll, your machine must have a problem related to it.

Lisias commented 2 years ago

@MgnfcntBstrd

There's a 3rd possibility. Perhaps the problem is on the mono runtime - I didn't thought on that possibility.

If by some reason the c:\Windows\System32 is not present on the mono's search PATH, then the Kernel32.dll will not be found - being it present or not on your system.

Geez… #facePalm

MgnfcntBstrd commented 2 years ago

Fortunately I know as much about mono as I do about linux or programming in general.

image

I force-fed Mono a kernel32.dll by dropping it into the folder it was looking for, and also tried setting the MONO_PATH environmental variable. I even went so far as to put that __LOCAL folder in GameData that it was looking for. But looking at the paths it is looking for now, I feel that perhaps the demands of the DLL are growing unreasonable. ;D

MgnfcntBstrd commented 2 years ago

It's also looking for a TweakScale folder in the KSP root.

image

MgnfcntBstrd commented 2 years ago

And now plugins. image

Lisias commented 2 years ago

These ones are not being used to look for Kernel32.dll. These are used to look for other things, unrelated to the code at hands.

Keep in mind that this tool are not monitoring the DLL loading, are monitoring every kind of file access being made - some of these attempts are merely checking the environment for the presence of some files, and not attempts to load an DLL.

On the other hand, thre's a Kernel32.dll there - inside the EmbeddedMono folder. Another situation in which things bork is when the DLL found by some reason is incompatible with the runtime - the aftermath is the same, from the caller point of view.

Lisias commented 2 years ago

Transfering this to KSPe, as that is the place where this can be handled.

Lisias commented 2 years ago

I think this is a duplicate for #27 (or vice versa).

I will keep this opened for while until confirmation.

Lisias commented 2 years ago

@tonimark @MgnfcntBstrd

Issue #27 apparently fixed the problem you guys described above. The fix was published on the latest Release here:

https://github.com/net-lisias-ksp/KSPApiExtensions/releases

I would appreciate if you guys could confirm the problem is solved.

Thanks in advance!

Lisias commented 1 year ago

Closing this issue, as I'm assuming the issue was fixed by lack of feedback.