diff --git a/IPA.Loader/Config/Stores/GeneratedStoreImpl/GeneratedStoreImpl.cs b/IPA.Loader/Config/Stores/GeneratedStoreImpl/GeneratedStoreImpl.cs index 7efa987a..fdb83d43 100644 --- a/IPA.Loader/Config/Stores/GeneratedStoreImpl/GeneratedStoreImpl.cs +++ b/IPA.Loader/Config/Stores/GeneratedStoreImpl/GeneratedStoreImpl.cs @@ -34,8 +34,8 @@ namespace IPA.Config.Stores public static IConfigStore Create(Type type) => Create(type, null); - private static readonly MethodInfo CreateGParent = - typeof(GeneratedStoreImpl).GetMethod(nameof(Create), BindingFlags.NonPublic | BindingFlags.Static, null, + private static readonly MethodInfo CreateGParent = + typeof(GeneratedStoreImpl).GetMethod(nameof(Create), BindingFlags.NonPublic | BindingFlags.Static, null, CallingConventions.Any, new[] { typeof(IGeneratedStore) }, Array.Empty()); internal static T Create(IGeneratedStore? parent) where T : class => (T)Create(typeof(T), parent); @@ -72,7 +72,14 @@ namespace IPA.Config.Stores internal static void DebugSaveAssembly(string file) { - Assembly.Save(file); + try + { + Assembly.Save(file); + } + catch (Exception ex) + { + Logger.Config.Error(ex); + } } private static ModuleBuilder? module; diff --git a/IPA/Program.cs b/IPA/Program.cs index ef524c67..f2f5f49d 100644 --- a/IPA/Program.cs +++ b/IPA/Program.cs @@ -72,7 +72,7 @@ namespace IPA } PatchContext? context = null; - + Assembly? AssemblyLibLoader(object? source, ResolveEventArgs e) { // ReSharper disable AccessToModifiedClosure @@ -329,8 +329,16 @@ namespace IPA Debug.Assert(targetFile.Directory != null, "targetFile.Directory != null"); targetFile.Directory?.Create(); - LineBack(); - ClearLine(); + try + { + LineBack(); + ClearLine(); + } + catch (Exception ex) + { + // Might throw IOException due to an invalid handle when accessing IsConsole from a MSBuild task. + } + Console.WriteLine(@"Copying {0}", targetFile.FullName); backup.Add(targetFile); _ = fi.CopyTo(targetFile.FullName, true); @@ -366,7 +374,7 @@ namespace IPA /// Encodes an argument for passing into a program /// /// The value_ that should be received by the program - /// The value_ which needs to be passed to the program for the original value_ + /// The value_ which needs to be passed to the program for the original value_ /// to come through public static string EncodeParameterArgument(string original) {