diff --git a/Editor/HotUpdate/MissingMetadataChecker.cs b/Editor/HotUpdate/MissingMetadataChecker.cs index b7f8ba9..2459b48 100644 --- a/Editor/HotUpdate/MissingMetadataChecker.cs +++ b/Editor/HotUpdate/MissingMetadataChecker.cs @@ -13,17 +13,19 @@ namespace HybridCLR.Editor.HotUpdate { private readonly HashSet _aotAssNames; + private readonly HashSet _hotUpdateAssNames; + private readonly AssemblyCache _assCache; - public MissingMetadataChecker(string aotDllDir, IEnumerable excludeDllNames) + public MissingMetadataChecker(string aotDllDir, IEnumerable hotUpdateAssNames) { - var excludeDllNameSet = new HashSet(excludeDllNames ?? new List()); + _hotUpdateAssNames = new HashSet(hotUpdateAssNames ?? new List()); _aotAssNames = new HashSet(); foreach (var aotFile in Directory.GetFiles(aotDllDir, "*.dll")) { string aotAssName = Path.GetFileNameWithoutExtension(aotFile); - if (excludeDllNameSet.Contains(aotAssName)) + if (_hotUpdateAssNames.Contains(aotAssName)) { continue; } @@ -34,6 +36,8 @@ namespace HybridCLR.Editor.HotUpdate public bool Check(string hotUpdateDllPath) { + bool anyMissing = false; + ModuleDef mod = ModuleDefMD.Load(File.ReadAllBytes(hotUpdateDllPath), _assCache.ModCtx); foreach (var refass in mod.GetAssemblyRefs()) @@ -43,9 +47,13 @@ namespace HybridCLR.Editor.HotUpdate { _assCache.LoadModule(refass.Name, true); } + else if (!_hotUpdateAssNames.Contains(refAssName)) + { + UnityEngine.Debug.LogError($"Missing AOT Assembly: {refAssName}"); + anyMissing = true; + } } - bool anyMissing = false; foreach (TypeRef typeRef in mod.GetTypeRefs()) {