DataObjects-NET / dataobjects-net

https://dataobjects.net
MIT License
60 stars 23 forks source link

Apply .NET8 `MethodInvoker`/`ConstructorInvoker` optimization #359

Closed SergeiPavlov closed 6 months ago

SergeiPavlov commented 7 months ago

Described here: https://github.com/dotnet/runtime/pull/88415 https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-8#reflection

alex-kulakov commented 6 months ago

@SergeiPavlov, I'm going to make new GetSingleConstructorInvokerOrDefault/GetSingleConstructorInvoker methods internal. Are you ok with that?

SergeiPavlov commented 6 months ago

I'm Ok, but what about GetSingleConstructorOrDefault() ? It is public but conditionally available only on <.NET8

alex-kulakov commented 6 months ago

Well, it is public and correct way of getting it out of public is to make it obsolete and then make it internal. It is a single-usage method. Probably, it will be deleted after NET6 and NET7 will be removed from project target frameworks. For now, all I can do is to make it obsolete to hint the future for possible users.

BTW, I'll make it exist in NET8 too to prevent possible compilation error on user side on framework upgrade, another reason is that ConstructorInvoker and ConstructorInfo are not interchangeable.