Using code with NET6 fails on some method resolving
joer33304 opened this issue · 6 comments
My nuget referenced code stopped working once I upgraded my solution to NET 6. I copied the lates RemoteLinq and Aqua sources to my solution and referenced it directly. This made my error go away but a new one appeared,
Below code does not work on for example OfType method. Binding flags come back as Default, so method is not marked as static.
Adding below code after DecalringType line fixes the issue:
if(member is System.Reflection.MethodInfo method)
{
IsStatic = method.IsStatic;
return;
}
Unfortunartely there are more issues with NET 6 :( We now have methods with same paramter count but overloads. So MethodInfo.cs crashes when creating the static method infos. I assume I maybe should not create a bug as there is no official NET 6 support ? Will there be a separate branch ? I could contribute wille using it and finding those issues
Hi @joer33304
Thanks for reporting this. While I have not started to adapt to net6.0 yet, I appreciate you creating issues as it speeds up the process.
Hi @joer33304
What setup are you testing with?
I just ran a quick test with net6.0 with no issue!?
VS 2022 Preview (Version 17.0.0 Preview 1.1)
dotnet --version
6.0.100-preview.5.21302.13
test:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="aqua-core" Version="5.0.0-alpha-050" />
</ItemGroup>
</Project>
class Program
{
static void Main(string[] args)
{
var bindingflags = System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public;
var systemmethodinfo = typeof(System.Linq.Enumerable).GetMethod(nameof(System.Linq.Enumerable.OfType), bindingflags);
var aquamethodinfo = new Aqua.TypeSystem.MethodInfo(systemmethodinfo);
var isStatic = aquamethodinfo.IsStatic;
}
}
sorry forgot to mention that this happens on the client which in my case is Blazor. Run the code above in a blazor webassembly project and IsStatic is false. I think I mentioned before, I did a quick fix for this but it crashed later at multiple methods found for some LinqMethods. You only check for parameter count and there are now a few overloads for the same count. After I fixed those issues all runs in blazor and NET 6.
Hi @joer33304
Thanks for clarifying. I've pushed changes to main branches and new alpha packages to myget feed that should fix the issues with webassembly/net6.0.
Closed due to inactivity. Feel free to reopen if required.