-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[HTTP/3] Support Single-file and NativeAOT on Windows #73290
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsHTTP/3 should be supported also in Single-file scenario on Windows. Linux is simple as msquic is "part of OS" - external package that is prereq for HTTP/3 to work. @vitek-karas can point us to what needs to happen to make it work.
|
Triage: We discussed with @vitek-karas that such work should be part of 8.0 -- it is too late for 7.0 and the usage of HTTP/3 is not that much widespread yet. |
@VSadov should know the technical details, but high level:
There's obviously a size aspect to all of this - as this will make the single-file host cca 500KB bigger - for everybody. |
I wonder if we could create bespoke single-file hosts that link to custom static libraries at publish-time. The apps that don't use Of course it would be an optional feature since it would need additional dependencies such as a native linker, and the default would still be a single-file host that links everything we might need. |
So far we've been trying to avoid dependency on platform linker for these scenarios. I think we might be able to do this for the NativeAOT version of this problem, since that one already has a dependency on platform linker. |
This requires to either (1) msquic repo to produce .lib file that gets statically linked into the singlefilehost in dotnet/runtme or (2) vendor msquic sources into dotnet/runtime and build it there for static linking into the singlefilehost. Once msquic is statically linked into the singlefilehost, the rest is trivial. |
@jkotas we build Windows in our fork https://github.com/dotnet/msquic -- that's how Windows DLLs are built for .NET Runtime product. |
Yes, it is certainly doable. If the .lib is built in one repo and consumed in second repo, there are details you need to be careful about - like making sure that the compiler versions and compiler options are the same or at least compatible between the repos. It may be challenging to manage at times when the compilers are getting upgraded. |
Another, completely orthogonal path could be that we align the Windows model with Linux, and we ship MsQuic via a package manager (winget), and .NET doesn't package msquic at all. .NET already has the code to opportunistically load msquic when available. The obvious downside with this approach is that you will always require an additional step, even in the single-file scenarios, to install the msquic dependency (if not already). So I'm not quite sure if you'd consider this solving the single-file problem or not. Generally, this seems to be deemed an acceptable model on Linux, but is not commonplace on Windows, and I suspect would receive push back. Just a thought though.... |
Part of Windows platform test is disabled against this issue: runtime/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicPlatformDetectionTests.cs Lines 23 to 38 in 47071da
See #81581 |
Pushing to 9.0 (Future at this moment) per offline discussion. |
Moving to 9.0.0 milestone now that it exists, per above comment. |
I have a .NET 8 AOT application that uses HTTP/3 with msquic on Windows x64. When I run the application 'standalone' from a console it can use H3. However, when I use the same AOT compiled code from a node application (a VSCode plugin) with (https://github.com/microsoft/node-api-dotnet), I get the following exception:
When I call MsQuicOpenVersion for version 2 returned -2147467262 status code. is the The other interesting bit is when I manually try to run this code in the same context (the difference is that I am passing IntPtr msQuicHandle;
var loaded = NativeLibrary.TryLoad("msquic.dll", typeof(System.Net.Quic.QuicConnection).Assembly, DllImportSearchPath.AssemblyDirectory, out msQuicHandle);
if (!loaded)
return Task.FromResult("not loaded");
var open = (delegate* unmanaged[Cdecl]<uint, QUIC_API_TABLE**, int>)NativeLibrary.GetExport(msQuicHandle, "MsQuicOpenVersion");
QUIC_API_TABLE* table = null;
var status = open((uint)1, &table);
return Task.FromResult($"{status} and {table != null}"); Is there a way to override the default way of loading the library (or just the version of it)? Is the wrong version of the |
You need to manually copy msquic.dll next to your single-file or native-aot compiled binary as a workaround for this issue. |
Thank you for the suggestion. I have tested it, but unfortunately in my case it does not work as the AOT application is run as a VSCode extension: When I put the dll next to the distributed files it does not get picked up, because The executable is a VSCode plugin is under: I was considering if I can update/change the way we still load the library with NativeLibrary.SetDllImportResolver, but that did not lead anywhere. I actually tried copying by hand the msquic.dll into the VSCode installation folder, and then everything works as expected, but unfortunately that is not a viable solution. |
I am using .NET 8 RC2. The plugin is an exe that is packaged as a .node file. |
The DLLs loaded with You can overwrite the base directory with your own value as a last resort with runtime/src/libraries/System.Private.CoreLib/src/System/AppContext.cs Lines 26 to 30 in 7faabde
|
I will check if I can override this in VS Code or use the AppContext as suggested. Thank you for the details. EDIT: Yes, that resolves the issue: I can package the file along the extension and set Thank you @jkotas and @MichalStrehovsky for the patience support for understanding the context. |
HTTP/3 should be supported also in Single-file and NativeAOT scenario on Windows.
Linux is simple as msquic is "part of OS" - external package that is prereq for HTTP/3 to work.
On Windows, we build and include msquic.dll as part of .NET Runtime.
@vitek-karas can point us to what needs to happen to make it work.
cc @jkotas
The text was updated successfully, but these errors were encountered: