From d4c25230482927f35ca4ac87deea43ae2e11b85c Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Tue, 22 Jan 2019 18:37:29 -0600 Subject: [PATCH] Fixed type loading error with workaround for Mono bug --- IPA.Injector/Injector.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/IPA.Injector/Injector.cs b/IPA.Injector/Injector.cs index 529c3204..6a05dec4 100644 --- a/IPA.Injector/Injector.cs +++ b/IPA.Injector/Injector.cs @@ -37,7 +37,18 @@ namespace IPA.Injector EnsureUserData(); - //log.Debug("Initializing logger"); + // this is weird, but it prevents Mono from having issues loading the type. + // IMPORTANT: NO CALLS TO ANY LOGGER CAN HAPPEN BEFORE THIS + var unused = StandardLogger.PrintFilter; + #region // Above hack explaination + /* + * Due to an unknown bug in the version of Mono that Unity 2018.1.8 uses, if the first access to StandardLogger + * is a call to a constructor, then Mono fails to load the type correctly. However, if the first access is to + * the above static property (or maybe any, but I don't really know) it behaves as expected and works fine. + */ + #endregion + + log.Debug("Initializing logger"); SelfConfig.Set();