I have written the following two SPM using URLSession to fetch remote data:
This is how I use the URLSession API:
They work fine on Linux and Apple systems.
However, they both fail on Windows.
As soon as the URLSession start retrieving remote data, the application immediately terminates with no error message generated.
// The July (1st half) 2024 snapshot build of Swift 6 and the Swift 5.10.1 stable build are both tried in this case. The July (2nd half) snapshot is unusable on Windows due to lack of a DLL.
I wonder what is happening with Swift Foundation URLSession on Windows.
If you have a simple standalone test case that demonstrates the issue, it might still be worth filing an issue on swift-foundation so that this can be looked into.
Yep, we'd definitely appreciate an issue filed on the repo so we can track this! It would also be helpful to know if this reproduces in both older (<=5.10) toolchains in addition to Swift 6/main or just one or the other. We recently overhauled swift-corelibs-foundation (where FoundationNetworking lives) and while the source code didn't change all too much for FoundationNetworking, it changed a bit as well as the build configuration so if this is only an issue in Swift 6 it could be a regression caused by the restructuring.
let (data, response) = try! await URLSession.shared.asyncData(from: URL(string: "http://example.com/")!)
works as expected on my Parallels Desktop Windows VM for ARM using both Swift 5.10.1 and 6.0. (I was also running into the DLL issues you mentioned earlier, but today's 6.0 toolchain build seems to be working for me.)
Perhaps the issue is Intel- or VMware Fusion-specific. I'll try to reproduce with an Intel setup to see if we can gather more info.