-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[DllImport] on Windows fails to load library on case sensitive filesystem #66608
Comments
What are you expecting here -- for interop to try every possible casing of 'dll' ? It seems there either needs to be a convention (which is apparently "DLL" inadvertently or not) or the code importing the library needs to include the extension. |
Including extension will be problematic when writing cross platform project. |
We depend on Windows OS to add the extension in this case. |
@wikancz As @jkotas mentioned we are relying upon the Windows OS to append the extension. I've confirmed internally that the extension being appended is indeed There isn't much the runtime can do other than try various permutations as @danmoseley mentioned above. While this approach is technically possible it isn't something we would be inclined to hard code into the runtime itself. I agree with you that I will update this thread when I get a response but for now close the issue as it is really existing Windows behavior and a documentation bug. |
We do append the lower-cased runtime/src/coreclr/vm/nativelibrary.cpp Line 597 in d603356
. in name will cause the runtime to append the lower-cased .dll instead of depending on the OS to do so. It means that we are inconsistent with the OS here.
I think we should either fix our handling of the corner-cases to be consistent with the OS, or we can take over and always append the lower-cased suffix as needed instead of depending on the OS. (I agree that the OS docs should be updated too.) |
Boo. I thought we got rid of that logic and were always depending on the Windows OS. Blech. Reopening and will update based on what I hear from Windows. |
@jkotas Thoughts on adding both the lowercase and uppercase? I'm not sure I like that but frankly the |
It doubles the amount of probing we would be doing in common case to handle a niche case. It does not sound like a good trade off to me. If I were to pick, I would go with always appending the lower-cased suffix as needed instead of depending on the OS. I expect that this issue is just a tip of the iceberg and number of other issues will show up if you try to run Windows .NET apps on case-sensitive file system. I do not think we need to worry about somebody depending on the existing Windows |
Okay.
I have the same feeling. |
@wikancz just curious, how do you come to mount a case sensitive filesystem on Windows? What is the scenario here? |
@danmoseley Some of our coworkers tried to work with our repository on Linux machines but ran into problems with incorrect file references caused by casing. |
gotcha, well thank you for reporting as I think this change is worthwhile. |
Description
[DllImport] on Windows fails to load library on case sensitive filesystem
System: Windows 10 (21H1)
.net version: 6.0
File system: NTFS with SetCaseSensitiveInfo enabled
Reproduction Steps
fsutil.exe file SetCaseSensitiveInfo C:\folder\path enable
somelibrary.dll
- note all letters are lower case[DllImport("somelibrary")]
without specifying extensionExpected behavior
Project correctly loads
somelibrary.dll
.Actual behavior
Project fails with exception:
DllNotFoundException: Unable to load DLL 'somelibrary' or one of its dependencies: The specified module could not be found. (0x8007007E)
Regression?
No response
Known Workarounds
Rename library to
somelibrary.DLL
.Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: