MonoInterp/Minijit win-x64: COM interop (SafeArray/Variant/struct reverse-pinvoke) test failures
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
## Summary
The COM/marshalling interop tests listed below fail on the **Mono Minijit, windows-x64** runtime-test leg (`DOTNET_RUNTIME_VARIANT=minijit`). They were first observed on the emsdk-upgrade PR #129299, but Minijit does **not** use LLVM, so these failures are independent of the emsdk/LLVM toolchain bump and appear to be pre-existing Mono win-x64 interop gaps. They are disabled with `[ActiveIssue(..., TestRuntimes.Mono)]` referencing this issue (originally bucketed under #84398, now split out).
## Configuration
- Pipeline: `runtime` (129), build [1469112](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1469112), PR #129299, merge SHA `a89b967`
- Leg: `windows-x64 Release AllSubsets_Mono_Minijit_RuntimeTests minijit`
- RuntimeFlavor: Mono · `DOTNET_RUNTIME_VARIANT=minijit` · arch x64 · OS windows
- AzDO "Send to Helix (Windows)" log: [build 1469112 / log 1428](https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_apis/build/builds/1469112/logs/1428)
- Helix job: [854d202d-1001-46ed-b32d-69a07704e193](https://helix.dot.net/api/jobs/854d202d-1001-46ed-b32d-69a07704e193/workitems?api-version=2019-06-17)
- Helix `Interop` work item console: https://helix.dot.net/api/2019-06-17/jobs/854d202d-1001-46ed-b32d-69a07704e193/workitems/Interop/console
## Failures
### 1. SafeArray multidimensional marshalling — `NullReferenceException`
`src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs`:
- `SafeArrayMarshallingTest.MultidimensionalIntArray`
- `SafeArrayMarshallingTest.MultidimensionalBoolArray`
- `SafeArrayMarshallingTest.MultidimensionalStringArray`
- `SafeArrayMarshallingTest.MultidimensionalStringArrayRoundTrip`
```
18:25:57.224 Running test: global::SafeArrayMarshallingTest.MultidimensionalIntArray()
System.NullReferenceException: Object reference not set to an instance of an object
at SafeArrayMarshallingTest.MultidimensionalIntArray()
at Program.<$>g__TestExecutor1|0_2(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass0_0&)
18:25:57.298 Failed test: global::SafeArrayMarshallingTest.MultidimensionalIntArray()
```
(The `...IntArrayRoundTrip` and `...BoolArrayRoundTrip` variants pass; the four listed above throw `NullReferenceException`.)
### 2. Variant marshalling — `MarshalDirectiveException: Marshalling of type object is not implemented`
Test assemblies `VariantTest`, `VariantTestBuiltInComDisabled`, `VariantTestComWrappers` (entry points in `src/tests/Interop/PInvoke/Variant/VariantTest.BuiltInCom.cs` and `VariantTest.ComWrappers.cs`):
```
18:25:57.426 Running test: Interop\PInvoke\Variant\VariantTest\VariantTest.dll
Built-in COM Disabled?: False
Test failed: System.Runtime.InteropServices.MarshalDirectiveException: Marshalling of type object is not implemented
at Test_VariantTest.TestByValue(Boolean hasComSupport)
at Test_VariantTest.TestEntryPoint()
Xunit.Sdk.EqualException: Assert.Equal() Failure: Values differ
Expected: 100
Actual: 101
```
### 3. DelegatePInvoke (struct by-ref, Cdecl) — `Assert.True()` failure
`src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs`
(`Interop\StructMarshalling\ReversePInvoke\MarshalExpStruct\DelegatePInvoke\DelegatePInvokeTest`):
```
Delegate,Pinvoke,By Ref,Cdecl
Calling Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr...
Test Failure: Xunit.Sdk.TrueException: Assert.True() Failure
Expected: True
...
Expected: 100
Actual: 101
END EXECUTION - FAILED
```
### 4. ReversePInvoke (struct by-ref, Cdecl) — wrong callback result
`src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/ReversePInvokeManaged/ReversePInvokeTest.cs`
(`Interop\StructMarshalling\ReversePInvoke\MarshalExpStruct\ReversePInvokeManaged\ReversePInvokeTest`):
```
Reverse,Pinvoke,By Ref,Cdecl
FAILED! TestMethod_DoCallBack_MarshalStructByRef_INNER2_Cdecl did not receive result as expected.
The Actual is...
INNER2.f1 = 77
INNER2.f2 = 77
...
Xunit.Sdk.TrueException
Expected: 100
Actual: 101
```
## Disabled in
All marked `[ActiveIssue("https://github.com/dotnet/runtime/issues/", TestRuntimes.Mono)]` on PR #129299.
> [!NOTE]
> This issue body was generated with the assistance of GitHub Copilot.
Contributor guide
Research direction
Start by reproducing the Windows-x64 Mono Minijit runtime-test leg and inspect the failures in src/tests/Interop/ArrayMarshalling/SafeArray/SafeArrayTest.cs, the Variant entry points, and the DelegatePInvoke and ReversePInvoke test files named above. Compare the failing marshalling cases with the passing variants, then verify that all listed tests pass and their ActiveIssue disabling can be removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- operating-systems, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100