diff --git a/Patcher/Patcher.cs b/Patcher/Patcher.cs index 451c51f..a4c891b 100644 --- a/Patcher/Patcher.cs +++ b/Patcher/Patcher.cs @@ -103,7 +103,17 @@ private static bool HasUnityAudioReferences() .Distinct() .Where(path => excludedAssemblyPrefixes.All(prefix => !Path.GetFileNameWithoutExtension(path).StartsWith(prefix))) .Where(path => ExcludedAssemblies.All(assembly => Path.GetFileNameWithoutExtension(assembly) != Path.GetFileNameWithoutExtension(path))) - .SelectMany(path => AssemblyDefinition.ReadAssembly(path).Modules) + .SelectMany(path => + { + try + { + return AssemblyDefinition.ReadAssembly(path).Modules; + } + catch + { // if we couldn't read the assembly it's probably not a .NET assembly anyway, so just ignore it + return Enumerable.Empty(); + } + }) .SelectMany(module => module.GetTypeReferences()) .Select(typeRef => typeRef.FullName) .Any(typeRefName => typeRefName.StartsWith("UnityEngine.Audio") || AdditionalTypeNames.Contains(typeRefName));