-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Set AppContext.BaseDirectory and the lookup path for AssemblyDirectory to the directory containing the NativeAOT module #112457
Set AppContext.BaseDirectory and the lookup path for AssemblyDirectory to the directory containing the NativeAOT module #112457
Conversation
…y to the directory containing the NativeAOT module
Could you add a test for this? I assume since this still doesn't build, it wasn't even manually tested to work, and we definitely don't have test coverage in the tree. |
Yes I need to still construct a test for this. I'll flip it to draft until I have it ready for review. |
src/coreclr/nativeaot/System.Private.CoreLib/src/System/AppContext.NativeAot.cs
Outdated
Show resolved
Hide resolved
@MichalStrehovsky I've added a test for this. |
src/coreclr/nativeaot/System.Private.CoreLib/src/System/AppContext.NativeAot.cs
Show resolved
Hide resolved
src/tests/nativeaot/SmokeTests/SharedLibraryDependencyLoading/SharedLibraryHost.cpp
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are failing but it looks reasonable to me otherwise, thanks!
Just last week I was helping someone in the Windows org who was building a DLL and wondered why they can't load a JSON file next to the DLL with AppContext.BaseDirectory.
I wonder if we should doc this as a breaking change, someone might use this and it would be nice to have guidance ready (just use the directory of the Environment.ProcessPath).
I'll mark this as a breaking change and file the doc after I fix the test and merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might also be good to add a note to the DllImportSearchPath.AssemblyDirectory
doc about Native AOT libraries.
src/tests/nativeaot/SmokeTests/SharedLibraryDependencyLoading/SharedLibraryDependency.cpp
Show resolved
Hide resolved
src/tests/nativeaot/SmokeTests/SharedLibraryDependencyLoading/SharedLibraryDependencyLoading.cs
Show resolved
Hide resolved
…re relative to the current working directory.
Native AOT outerloop runs are broken: many tests failing with "The path must be absolute":
If I'm reading this right the problem is that we somehow end up using the path of If this cannot be fixed quickly, I'd prefer this to be reverted because it's failing 100 tests and it's hard to keep an eye on outerloop with so many failures. |
Sample outerloop run with the failures: https://dev.azure.com/dnceng-public/public/_build/results?buildId=968880&view=logs&j=7e7cde7f-4669-5f41-976b-370a74291e60&t=e3f1bc70-511c-5e38-2600-aec10f79e344 |
I'll take a look today and if I can't fix it I'll revert it. |
Fixes #112290
Fixes #90131
We already had most of the components needed to wire this up in the NativeAOT PAL and in the EH DeveloperExperience APIs, so this wasn't as bad as I thought.