-
Notifications
You must be signed in to change notification settings - Fork 305
Add | Add net8 compatibility #1934
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
Conversation
I will do some changes to this PR, such as the csproj file to include SqlTypeWorkarounds to be included if it is net6 only and changing the Net 8 to net 7 for now. |
You can't change the net8 to 7 because this is adding support for new apis that aren't in 7. For the rest, go ahead. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1934 +/- ##
==========================================
- Coverage 70.82% 70.67% -0.16%
==========================================
Files 292 305 +13
Lines 61777 61794 +17
==========================================
- Hits 43752 43670 -82
- Misses 18025 18124 +99
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
The new APIs made it into .net7 last year. I think we are good to go on this PR. |
follow up changes for PR dotnet#1934
follow up changes for PR dotnet#1934
) follow up changes for PR dotnet#1934
Hello, we just stumbled over #1930 |
Why is your code, or your vendor code, touching internal types in an assembly it does not own? |
I'm not sure what you mean by touching. We just used SqlClient with NHibernate in dotnet 8 for some months in an ordinary line-of-business-application. Everthinig was fine with version 5.1.6. Then we made some changes to entity definitions and data mappings and got the same runtime exception as in #1930. I have no idea what triggered the change but we were not doing anything fancy in the internals. |
The only way to touch SqlGuidCaster is through reflection accessing internal types inside SqlClient. That's why it wasn't found in testing, it wasn't used and the public surface area wasn't changed. If your dependency, NHibernate was using private reflection then it should not have been. |
@Wraith2 Looks like this repros:
|
Small Correction: There was no code change in the data access layer (Entiies, ,mappings). The new code that triggers the exception is a readonly reflection call If this looking into the types via reflection without changing anything is what you mean with "touching" then yes - we are touching the types. It's readonly - we are not changing anything! |
closes #1930
In netcore builds SqlGuidCaster and the type workaround that used it are not required. The problem they solved has already been change to use the ReadOnlySpan ctor. The SqlGuid workarounds in netcore are removed. Netfx builds use a more recent approach to the original problem and do not need to change.
I have also added ifdeffed use of the new api's introduced to the ryntime in dotnet/runtime#72724 so if/when a net8 build is created the new methods will be used and the workarounds will be ifdeffed out entirely.
Testing on net was done manually with a small repro app that used reflection to force SqlGuidCaster to be compiled. Before these change the reported TypeLoadException was encountered, after them it is not.
/cc @Alerinos @MichalPetryka