Skip to content

Disabling runtime marshaling broke DomainControllerTests.FindAll_NoSuchName_ReturnsEmpty()  #65259

@danmoseley

Description

@danmoseley
     <test name="System.DirectoryServices.ActiveDirectory.Tests.DomainControllerTests.FindAll_NoSuchName_ReturnsEmpty" type="System.DirectoryServices.ActiveDirectory.Tests.DomainControllerTests" method="FindAll_NoSuchName_ReturnsEmpty" time="0.0115152" result="Fail">
        <failure exception-type="System.Runtime.InteropServices.MarshalDirectiveException">
          <message><![CDATA[System.Runtime.InteropServices.MarshalDirectiveException : Cannot marshal 'parameter #7': Cannot marshal managed types when the runtime marshalling system is disabled.]]></message>
          <stack-trace><![CDATA[   at System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointerInternal(IntPtr ptr, Type t)
   at System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(IntPtr ptr, Type t) in C:\git\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs:line 1122
   at System.DirectoryServices.ActiveDirectory.Utils.GetDNFromDnsName(String dnsName) in C:\git\runtime\src\libraries\System.DirectoryServices\src\System\DirectoryServices\ActiveDirectory\Utils.cs:line 204
   at System.DirectoryServices.ActiveDirectory.DomainController.FindAllInternal(DirectoryContext context, String domainName, Boolean isDnsDomainName, String siteName) in C:\git\runtime\src\libraries\System.DirectoryServices\src\System\DirectoryServices\ActiveDirectory\DomainController.cs:line 1069
   at System.DirectoryServices.ActiveDirectory.DomainController.FindAll(DirectoryContext context) in C:\git\runtime\src\libraries\System.DirectoryServices\src\System\DirectoryServices\ActiveDirectory\DomainController.cs:line 259
   at System.DirectoryServices.ActiveDirectory.Tests.DomainControllerTests.FindAll_NoSuchName_ReturnsEmpty() in C:\git\runtime\src\libraries\System.DirectoryServices\tests\System\DirectoryServices\ActiveDirectory\DomainControllerTests.cs:line 121]]></stack-trace>
        </failure>
      </test>

NativeMethods.DsCrackNames dsCrackNames = (NativeMethods.DsCrackNames)Marshal.GetDelegateForFunctionPointer(functionPtr, typeof(NativeMethods.DsCrackNames));

It seems it cannot marshal this

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 build clr+libs+libs.tests -rc release -lc debug -test

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions