Uh oh!
There was an error while loading. Please reload this page.
Modernize DotNetSdkLocationHelper and hostfxr interop. - #339
Merged
Conversation
YuliiaKovalova
commented
Sep 29, 2025
Contributor
hi Theodore Tsirpanis (@teo-tsirpanis) |
ContributorAuthor
YuliiaKovalova conflicts resolved. |
YuliiaKovalova
approved these changes
Sep 29, 2025
Rainer Sigwald (rainersigwald)
approved these changes
Sep 29, 2025
Rainer Sigwald (rainersigwald)
requested changes
Sep 29, 2025
Rainer Sigwald (rainersigwald)
left a comment
Member
There was a problem hiding this comment.
No, wait, something is wrong:
❯ .\samples\BuilderApp\bin\Debug\net8.0\BuilderApp.exe .\MSBuildLocator.slnSample MSBuild Builder App 1.9.7+e4c2ece661.Process terminated. Assertion failed. at Microsoft.Build.Locator.NativeMethods.hostfxr_resolve_sdk2_callback(hostfxr_resolve_sdk2_result_key_t key, Void* value) in S:\work\MSBuildLocator\src\MSBuildLocator\NativeMethods.cs:line 63 at Microsoft.Build.Locator.NativeMethods.<hostfxr_resolve_sdk2>g____PInvoke|4_0(Void* __exe_dir_native, Void* __working_dir_native, hostfxr_resolve_sdk2_flags_t __flags_native, __result_native) at Microsoft.Build.Locator.NativeMethods.<hostfxr_resolve_sdk2>g____PInvoke|4_0(Void* __exe_dir_native, Void* __working_dir_native, hostfxr_resolve_sdk2_flags_t __flags_native, __result_native) at Microsoft.Build.Locator.NativeMethods.hostfxr_resolve_sdk2(String exe_dir, String working_dir, hostfxr_resolve_sdk2_flags_t flags, result) in S:\work\MSBuildLocator\src\MSBuildLocator\obj\Debug\net8.0\Microsoft.Interop.LibraryImportGenerator\Microsoft.Interop.LibraryImportGenerator\LibraryImports.g.cs:line 19 at Microsoft.Build.Locator.NativeMethods.hostfxr_resolve_sdk2(String exe_dir, String working_dir, hostfxr_resolve_sdk2_flags_t flags, String& resolved_sdk_dir, String& global_json_path) in S:\work\MSBuildLocator\src\MSBuildLocator\NativeMethods.cs:line 36 at Microsoft.Build.Locator.DotNetSdkLocationHelper.<GetInstances>g__GetSdkFromGlobalSettings|4_2(String workingDirectory) in S:\work\MSBuildLocator\src\MSBuildLocator\DotNetSdkLocationHelper.cs:line 153 at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetInstances(String workingDirectory, Boolean allowQueryAllRuntimes, Boolean allowAllDotnetLocations)+MoveNext() in S:\work\MSBuildLocator\src\MSBuildLocator\DotNetSdkLocationHelper.cs:line 82 at Microsoft.Build.Locator.MSBuildLocator.GetInstances(VisualStudioInstanceQueryOptions options)+MoveNext() in S:\work\MSBuildLocator\src\MSBuildLocator\MSBuildLocator.cs:line 389 at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList() at BuilderApp.Program.Main(String[] args) in S:\work\MSBuildLocator\samples\BuilderApp\Program.cs:line 26Rainer Sigwald (rainersigwald)
commented
Sep 29, 2025
Member
It is getting called twice, the first time with Maybe the assertions should be moved inside the switch Theodore Tsirpanis (@teo-tsirpanis)? |
ContributorAuthor
Removed assertions, as per the other native callback. |
Rainer Sigwald (rainersigwald)
approved these changes
Sep 29, 2025
Rainer Sigwald (rainersigwald)
left a comment
Member
There was a problem hiding this comment.
Fantastic, thank you!
This was referenced Apr 28, 2026
This was referenced May 11, 2026
Closed
This was referenced May 18, 2026
Closed
This was referenced Jun 2, 2026
This was referenced Jun 10, 2026
This was referenced Jul 2, 2026
This was referenced Aug 19, 2026
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NativeMethodsclass was updated to use the P/Invoke source generator, and[UnmanagedCallersOnly]. The changes made are in a similar vein to UseUnmanagedCallersOnlyinAssemblyDependencyResolver. dotnet/runtime#119034.DotNetSdkLocationHelperclass was updated to use APIs added in newer frameworks, like the regex source generator, or APIs to resolve symlinks. The latter also lets us remove the P/Invokes tolibc.