Skip to content

fix: Windows CI build (EventLogRecord + SUBCLASSPROC) - #1

Merged
piranout merged 3 commits into
mainfrom
cursor/fix-windows-ci-build-d487
Aug 20, 2026
Merged

fix: Windows CI build (EventLogRecord + SUBCLASSPROC)#1
piranout merged 3 commits into
mainfrom
cursor/fix-windows-ci-build-d487

Conversation

@piranout

@piranout piranout commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Windows dotnet build Reentry.slnx -c Release was failing on main (9f581d0, run 32403780666). C# errors hid a later WASDK architecture check.

Cause

  1. System.Diagnostics.EventLog introduces System.Diagnostics.Eventing.Reader.EventLogRecord, which collided with Reentry.Core.Models.EventLogRecord in Win32EventLogReader. That also broke IEventLogReader.ReadRecent.
  2. CsWin32 0.3 + current Windows SDK metadata does not emit SUBCLASSPROC, so EndSessionHook could not compile even with the subclass APIs listed in NativeMethods.txt.
  3. Win32ProcessProbe: LiveProcess named args are PascalCase (CommandLine / StartedUtc); _ = GetWindowThreadProcessId(...) assigned a uint into the EnumWindows LPARAM parameter named _; HWND.Value is void* and does not convert to LiveWindow.Handle (long).
  4. After C# compiled, WindowsAppSDKSelfContained rejected AnyCPU (the dotnet build default) because no RID was set.

Fix

  • Alias the Core EventLogRecord as the public/interface type. Keep the System.Diagnostics.EventLog package.
  • P/Invoke comctl32 SetWindowSubclass / RemoveWindowSubclass / DefSubclassProc with a [UnmanagedFunctionPointer(CallingConvention.Winapi)] delegate. Same attach-to-HWND behavior, same try/catch so shutdown is never blocked. Drop unused CsWin32 subclass names from NativeMethods.txt.
  • Correct Win32ProcessProbe construction and CsWin32 handle types.
  • Default RuntimeIdentifier to win-x64 when Platform is AnyCPU / unset so dotnet build Reentry.slnx -c Release works. Explicit -r / Platform still win.

No new features, no admin, no injection beyond this user-mode WndProc. Unpackaged WASDK 2.4, x64 shipping matches publish.ps1 / release.

Verify

  • dotnet build Reentry.slnx -c Release on windows-latest
  • dotnet test tests/Reentry.Core.Tests -c Release (39 passed locally)
Open in Web Open in Cursor 

cursoragent and others added 3 commits August 20, 2026 18:58
CsWin32 0.3 does not emit SUBCLASSPROC; call comctl32 SetWindowSubclass
directly. Alias the Core EventLogRecord so the EventLog package type
does not break IEventLogReader.

Co-authored-by: Paul Smith <piranout@users.noreply.github.com>
Named record args are PascalCase. Do not assign EnumWindows LPARAM
to GetWindowThreadProcessId's DWORD. HWND.Value is void* — cast to long.

Co-authored-by: Paul Smith <piranout@users.noreply.github.com>
WindowsAppSDKSelfContained rejects AnyCPU, which is what
`dotnet build Reentry.slnx -c Release` uses. Keep explicit -r / Platform.

Co-authored-by: Paul Smith <piranout@users.noreply.github.com>
@piranout
piranout marked this pull request as ready for review August 20, 2026 19:10
@piranout
piranout merged commit 78dc5cd into main Aug 20, 2026
1 check passed
@piranout
piranout deleted the cursor/fix-windows-ci-build-d487 branch August 20, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants