-
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
Disabling runtime marshaling broke DomainControllerTests.FindAll_NoSuchName_ReturnsEmpty() #65259
Comments
Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 Issue Details
runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Utils.cs Line 204 in a1f0147
It seems it cannot marshal this Line 494 in a1f0147
This may have been an edit that was missed from #64279 perhaps because the codepath didn't exercise due to different network config. @jkoritzinsky can you advise here? Looking at the other changes you made, I'm unclear what is needed. as an aside this code change seems like it should be made at the same time - NativeMethods.DsCrackNames dsCrackNames = Marshal.GetDelegateForFunctionPointer(functionPtr, typeof(NativeMethods.DsCrackNames));
+ NativeMethods.DsCrackNames dsCrackNames = Marshal.GetDelegateForFunctionPointer<NativeMethods.DsCrackNames>(functionPtr); this is on CoreCLR
|
Re the aside, we have ~30 uses of |
@danmoseley if you change that last parameter to be an Re the aside: yes, those should be changed to use the generic version. |
@jkoritzinsky is there a way to scan, or grep, for other such issues (of the IntPtr* change) so we don't rely only on unit tests? In some libraries like this one, there are plenty of pinvokes, but the code coverage is not great, especially of error paths. |
I have an analyzer that will catch all of these cases at dotnet/roslyn-analyzers#5822. Just waiting on review to get it merged. |
I ended up with this danmoseley@4990310 Is that right? The code looks strictly worse. Is there something I can read to help me understand why this is necessary? There are ~20 odd pinvokes that have |
I guess, you can run your analyzer/fixer locally against this library to test it that way :) |
@danmoseley this issue explains the rationale behind the "disabled runtime marshalling" mode: The source generator is using this mode to enable it to easily determine which types do not require any marshalling by checking if a type is I can take care of these fixes. |
Delegate-based P/Invokes haven't yet moved a source-generated model, so they don't interact particularly cleanly with the disabled runtime marshalling mode if they use a lot of marshalling. |
Got it - essentially Thanks for doing the cleanup @jkoritzinsky |
…unction pointers. All of the delegates used very simple marshalling and they were all used in one or two places immediately after a GetProcAddress call for them, so it seemed like it was worthwhile to go all the way to function pointers instead of just manually pinning the parameters and still allocating delegates. Fixes dotnet#65259
runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Utils.cs
Line 204 in a1f0147
It seems it cannot marshal this
runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/NativeMethods.cs
Line 494 in a1f0147
This may have been an edit that was missed from #64279 perhaps because the codepath didn't exercise due to different network config. @jkoritzinsky can you advise here? Looking at the other changes you made, I'm unclear what is needed.
as an aside this code change seems like it should be made at the same time
this is on CoreCLR
build clr+libs+libs.tests -rc release -lc debug -test
The text was updated successfully, but these errors were encountered: