undo parallel loop (#716)

This caused errors during rewriting to be obfuscated with null reference exceptions.
This commit is contained in:
Jesse Plamondon-Willard 2020-06-02 22:05:00 -04:00
parent 6f4063cd86
commit 73e3735dcd
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,6 @@
* Mod warnings are now listed alphabetically. * Mod warnings are now listed alphabetically.
* MacOS files starting with `._` are now ignored and can no longer cause skipped mods. * MacOS files starting with `._` are now ignored and can no longer cause skipped mods.
* Simplified paranoid warning logs and reduced their log level. * Simplified paranoid warning logs and reduced their log level.
* Reduced startup time when loading mod DLLs (thanks to ZaneYork!).
* Fixed `BadImageFormatException` error detection. * Fixed `BadImageFormatException` error detection.
* Fixed black maps on Android for mods which use `.tmx` files. * Fixed black maps on Android for mods which use `.tmx` files.

View File

@ -56,12 +56,13 @@ namespace StardewModdingAPI.Framework.ModLoading.Framework
/// <summary>Rewrite the loaded module code.</summary> /// <summary>Rewrite the loaded module code.</summary>
/// <returns>Returns whether the module was modified.</returns> /// <returns>Returns whether the module was modified.</returns>
public bool RewriteModule() public bool RewriteModule()
{
return this.Module.GetTypes().AsParallel().WithExecutionMode(ParallelExecutionMode.ForceParallelism).Select(type =>
{ {
bool anyRewritten = false; bool anyRewritten = false;
foreach (TypeDefinition type in this.Module.GetTypes())
{
if (type.BaseType == null) if (type.BaseType == null)
return false; // special type like <Module> continue; // special type like <Module>
anyRewritten |= this.RewriteCustomAttributes(type.CustomAttributes); anyRewritten |= this.RewriteCustomAttributes(type.CustomAttributes);
anyRewritten |= this.RewriteGenericParameters(type.GenericParameters); anyRewritten |= this.RewriteGenericParameters(type.GenericParameters);
@ -107,9 +108,9 @@ namespace StardewModdingAPI.Framework.ModLoading.Framework
} }
} }
} }
}
return anyRewritten; return anyRewritten;
}).Max();
} }