diff --git a/Data~/NetStandard/netstandard2.0.dll b/Data~/NetStandard/netstandard2.0.dll new file mode 100644 index 0000000..250cf81 Binary files /dev/null and b/Data~/NetStandard/netstandard2.0.dll differ diff --git a/Data~/NetStandard/netstandard2.1.dll b/Data~/NetStandard/netstandard2.1.dll new file mode 100644 index 0000000..99d1889 Binary files /dev/null and b/Data~/NetStandard/netstandard2.1.dll differ diff --git a/Editor/Meta/AssemblyCache.cs b/Editor/Meta/AssemblyCache.cs index 04a7442..be85acb 100644 --- a/Editor/Meta/AssemblyCache.cs +++ b/Editor/Meta/AssemblyCache.cs @@ -15,6 +15,7 @@ namespace HybridCLR.Editor.Meta private readonly ModuleContext _modCtx; private readonly AssemblyResolver _asmResolver; private bool disposedValue; + private bool _loadedNetstandard; public Dictionary LoadedModules { get; } = new Dictionary(); @@ -34,6 +35,15 @@ namespace HybridCLR.Editor.Meta { return mod; } + if (moduleName == "netstandard") + { + if (!_loadedNetstandard) + { + LoadNetStandard(); + _loadedNetstandard = true; + } + return null; + } mod = DoLoadModule(_assemblyPathResolver.ResolveAssembly(moduleName, true)); LoadedModules.Add(moduleName, mod); @@ -48,6 +58,12 @@ namespace HybridCLR.Editor.Meta return mod; } + private void LoadNetStandard() + { + LoadModule("netstandard2.0", false); + LoadModule("netstandard2.1", false); + } + private ModuleDefMD DoLoadModule(string dllPath) { //Debug.Log($"do load module:{dllPath}"); diff --git a/Editor/Meta/AssemblyReferenceDeepCollector.cs b/Editor/Meta/AssemblyReferenceDeepCollector.cs index 8850aac..9d6e80f 100644 --- a/Editor/Meta/AssemblyReferenceDeepCollector.cs +++ b/Editor/Meta/AssemblyReferenceDeepCollector.cs @@ -17,6 +17,7 @@ namespace HybridCLR.Editor.Meta private readonly ModuleContext _modCtx; private readonly AssemblyResolver _asmResolver; private bool disposedValue; + private bool _loadedNetstandard; public Dictionary LoadedModules { get; } = new Dictionary(); @@ -66,6 +67,15 @@ namespace HybridCLR.Editor.Meta { return mod; } + if (moduleName == "netstandard") + { + if (!_loadedNetstandard) + { + LoadNetStandard(); + _loadedNetstandard = true; + } + return null; + } mod = DoLoadModule(_assemblyPathResolver.ResolveAssembly(moduleName, true)); LoadedModules.Add(moduleName, mod); @@ -84,6 +94,12 @@ namespace HybridCLR.Editor.Meta return mod; } + private void LoadNetStandard() + { + DoLoadModule(_assemblyPathResolver.ResolveAssembly("netstandard2.0", true)); + DoLoadModule(_assemblyPathResolver.ResolveAssembly("netstandard2.1", true)); + } + protected virtual void Dispose(bool disposing) { if (!disposedValue) diff --git a/Editor/Meta/MetaUtil.cs b/Editor/Meta/MetaUtil.cs index 4f9a36e..5b3657d 100644 --- a/Editor/Meta/MetaUtil.cs +++ b/Editor/Meta/MetaUtil.cs @@ -170,7 +170,8 @@ namespace HybridCLR.Editor.Meta { return new CombinedAssemblyResolver( CreateHotUpdateAssemblyResolver(target, hotUpdateDlls), - CreateAOTAssemblyResolver(target) + CreateAOTAssemblyResolver(target), + new PathAssemblyResolver($"{SettingsUtil.HybridCLRDataPathInPackage}/NetStandard") ); } diff --git a/Editor/ReversePInvokeWrap/Analyzer.cs b/Editor/ReversePInvokeWrap/Analyzer.cs index 4a77924..e089c5b 100644 --- a/Editor/ReversePInvokeWrap/Analyzer.cs +++ b/Editor/ReversePInvokeWrap/Analyzer.cs @@ -33,9 +33,9 @@ namespace HybridCLR.Editor.ReversePInvokeWrap public Analyzer(AssemblyCache cache, List assemblyNames) { - foreach(var assemblyName in assemblyNames) + foreach (var assemblyName in assemblyNames) { - _rootModules.Add(cache.LoadModule(assemblyName, false)); + _rootModules.Add(cache.LoadModule(assemblyName)); } }