-
Notifications
You must be signed in to change notification settings - Fork 4.9k
[WIP] Add NativeLibrary reference assemblies and tests #27258
[WIP] Add NativeLibrary reference assemblies and tests #27258
Conversation
Yes, I know submitting binary files is horrible. The reason it's proposed this way is that it allows the build to succeed in all environments (including from the IDE). I've tweaked the .vcxproj files to ensure that they're producing the smallest possible outputs. GitHub also seems to think the .c / .h files are binary so won't show them properly in the diff window. Hitting 'View' on each file will show them correctly. I'll look into this and try to address it in the near future. |
/cc @ahsonkhan @bartonjs |
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.
- Consider adding an update script, a la the FIleVersionInfo tests
- nativelibrarywin.c (and the .h files) is/are appearing here as binary, please try to rectify that.
- Please add argument validation tests
- name != null
- times when caller is required
- Values (mapped or unmapped) for search paths which are not allowed
- etc
- Please add tests for GetSymbolAddress returning something other than a function pointer
- Anything we can assert about the Handle value (!= IntPtr.Zero, that using it you can use GetProcAddress to get the same answer as TryGetSymbolAddress, etc)
public static TDelegate GetDelegate<TDelegate>(this NativeLibrary nativeLibrary, string name, bool exactSpelling = false) where TDelegate : class | ||
{ | ||
nativeLibrary.TryGetDelegate<TDelegate>(name, exactSpelling, out var retVal); | ||
return retVal; |
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.
Consider having this test-only extension assert that the nullarity of retVal
and the return value are consistent.
I do not think we should be checking in binaries. If CoreFX does not make it easy to add native binaries for testing, we should have tests for this in CoreCLR instead. CoreCLR has infrastucture for native test binaries. |
All interesting interop tests are in CoreCLR today for this and other reasons. |
@GrabYourPitchforks what is status of this PR? Do you plan to finish it for 2.1? |
Couldn't get consensus on feature before deadline, so punted to Future. |
This is the corefx equivalent of dotnet/coreclr#16409.