Skip to content

Commit

Permalink
Merge pull request #573 from microsoft/fixClrTypeLoad
Browse files Browse the repository at this point in the history
Add failing test to track type load exception
  • Loading branch information
AArnott authored Jun 1, 2022
2 parents 6903ae7 + dc86f22 commit 01d624d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 31 deletions.
18 changes: 18 additions & 0 deletions test/GenerationSandbox.Tests/BasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,22 @@ public void ZeroOrMinusOneIsInvalidSafeHandle()
h = new(new IntPtr(-1), ownsHandle: false);
Assert.True(h.IsInvalid);
}

/// <summary>
/// Verifies that structs with explicit field placement where managed and unmanaged values overlap do not cause a TypeLoadException.
/// </summary>
/// <remarks>
/// This demonstrates the problem tracked by <see href="https://github.com/microsoft/CsWin32/issues/292">this bug</see>.
/// </remarks>
[Fact(Skip = "Failure tracked by #292")]
public void LoadProblematicTypes()
{
Windows.Win32.System.Com.VARDESC d = new()
{
Anonymous =
{
oInst = 3,
},
};
}
}
5 changes: 3 additions & 2 deletions test/GenerationSandbox.Tests/NativeMethods.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ IPersistFile
KEY_EVENT_RECORD
LoadLibrary
MainAVIHeader
MAX_PATH
NTSTATUS
PathParseIconLocation
RegLoadAppKey
RM_PROCESS_INFO
ShellLink
VARDESC
WER_REPORT_INFORMATION
wglGetProcAddress
WPARAM
WriteFile
PathParseIconLocation
MAX_PATH
8 changes: 4 additions & 4 deletions test/SpellChecker/NativeMethods.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CoCreateInstance
CLSCTX
CoCreateInstance
CoTaskMemFree
SpellCheckerFactory
ISpellCheckerFactory
ISpellChecker
CLSCTX
ISpellCheckerFactory
S_FALSE
S_OK
SpellCheckerFactory
50 changes: 25 additions & 25 deletions test/WinRTInteropTest/NativeMethods.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
CreateDispatcherQueueController
HWND
ICompositorDesktopInterop
BeginPaint
BS_PUSHBUTTON
CreateDispatcherQueueController
CreateWindowExW
WNDCLASSEXW
RegisterClassExW
CW_USEDEFAULT
DefWindowProc
DestroyWindow
DispatchMessage
EndPaint
GetMessage
GetModuleHandle
LoadCursor
LoadIcon
HDC
HINSTANCE
HMENU
HWND
ICompositorDesktopInterop
IDC_ARROW
IDI_APPLICATION
InvalidateRect
LoadCursor
LoadIcon
MSG
PAINTSTRUCT
PostMessage
PostQuitMessage
RegisterClassExW
ShowWindow
UpdateWindow
GetMessage
TranslateMessage
DispatchMessage
MSG
WM_CREATE
HMENU
HINSTANCE
UpdateWindow
WM_CLOSE
WM_COMMAND
WM_CREATE
WM_DESTROY
PostQuitMessage
WM_PAINT
HDC
BeginPaint
EndPaint
WM_CLOSE
DestroyWindow
PAINTSTRUCT
InvalidateRect
PostMessage
CW_USEDEFAULT
BS_PUSHBUTTON
WNDCLASSEXW

0 comments on commit 01d624d

Please sign in to comment.