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

Remove unused PInvokes #2828

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

edwardneal
Copy link
Contributor

This is the first step of a process to merge PInvokes between the .NET and .NET Framework projects. I've started by removing most of the unused PInvokes from both projects. There shouldn't be any surprises in CI.

I've also changed SqlUtil's SocketDidNotThrow method to throw an Exception rather than an InternalException. This was the only reference to InternalException which for the .NET 8.0 target, so this change means that when .NET 6.0 support is dropped, everything in the netcore/src/Common/src/System folder except for NotImplemented.cs can be removed.

The next step of the PInvoke merge process will be more involved. What's the coding standard for this? dotnet/runtime uses one folder per OS, one subfolder per DLL, one file per method, and there are quite a few files which fit this pattern. Other parts of the .NET project have a single file containing every PInvoke for a single DLL (the SNI DLL.)

Step 2 will be to merge the OS PInvokes which are needed for .NET Framework and .NET 8.0, and step 3 is currently to address the native SNI PInvokes. At the point of step 3, I'd also like to change the .NET Framework project to refer to Microsoft.Data.SqlClient.SNI.runtime, so it matches the .NET project. This might depend on #2671.

* Changed the exception type thrown by SQL.SocketDidNotThrow from InternalException.
* Excluded InternalException and NetEventSource from compilation in .NET 8.0 target.
@JRahnama JRahnama added this to the 6.0-preview2 milestone Sep 1, 2024
@JRahnama JRahnama added the ➕ Code Health Changes related to source code improvements label Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
➕ Code Health Changes related to source code improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants