Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

热更域泛型接口的实现类 在ILType.InitializeInterfaces()时 获取到的接口为null #715

Open
SunHowe opened this issue Jul 13, 2022 · 1 comment

Comments

@SunHowe
Copy link

SunHowe commented Jul 13, 2022

ILRuntime版本: UPM上的2.1.0-preview.1

在热更域中,定义了泛型接口与它的实现类:

public interface IPool<T> : IDisposable where T : class
{
}

public sealed class Pool<T> : IPool<T> where T : class
{
}

然后观察到在ILType.InitializeInterfaces()时,下图红框部分会返回null
lQLPJxZ94jrV4aDNAZDNBIywZnzcmAmfL2QCz1BtkoAsAA_1164_400

进一步导致的问题是,在热更域中用反射判断interfaceType.IsAssignableFrom(type)时,下图红色区域部分会触发NullReferenceException

lQLPJxZ94nB6yvnMp80CSrA1H_XzQpq0qwLPUMV4QG8A_586_167

@SunHowe
Copy link
Author

SunHowe commented Jul 13, 2022

与跨域继承IDisposable接口无关 经测试将接口简化成

public interface IPool<T> where T : class
{
}

也一样存在这个问题。

而且接口本身的实现与调用均没问题,仅在用到对应的Type相关的接口时,可能会出现NullReferenceException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant