[fix] 修复当dll中存在指向本程序集内的TypeRef时,dnlib的TypeDef.DefinitionAssembly返回null导致 Link/Analyzer.cs运行抛出异常的bug
parent
97dae7fed2
commit
60016d7481
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||
using dnlib.DotNet;
|
||||
using HybridCLR.Editor.Meta;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using IAssemblyResolver = HybridCLR.Editor.Meta.IAssemblyResolver;
|
||||
|
||||
namespace HybridCLR.Editor.Link
|
||||
|
@ -32,6 +33,11 @@ namespace HybridCLR.Editor.Link
|
|||
var dnAss = assCollector.LoadModule(rootAss, false);
|
||||
foreach (var type in dnAss.GetTypeRefs())
|
||||
{
|
||||
if (type.DefinitionAssembly == null)
|
||||
{
|
||||
Debug.LogWarning($"assembly:{dnAss.Name} TypeRef {type.FullName} has no DefinitionAssembly");
|
||||
continue;
|
||||
}
|
||||
if (!rootAssemblyNames.Contains(type.DefinitionAssembly.Name.ToString()))
|
||||
{
|
||||
typeRefs.Add(type);
|
||||
|
|
Loading…
Reference in New Issue