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
Log windows messages in tests #10916
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10916 +/- ##
===================================================
+ Coverage 72.62206% 73.19639% +0.57432%
===================================================
Files 2933 3091 +158
Lines 620328 643876 +23548
Branches 46946 51725 +4779
===================================================
+ Hits 450495 471294 +20799
- Misses 161477 168934 +7457
+ Partials 8356 3648 -4708
Flags with carried forward coverage won't be shown. Click here to find out more. |
I can't get this to fail. I tried. |
using var messageRecordService = new WindowsMessageRecordService(); | ||
using var screenRecordService = new ScreenRecordService(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like having these build up. I plan to refactor it in a follow-up to have a single data collection service that delegates to items within it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind having these very explicitly visible in the base class.
Could you please add some way to enable message logging on specific tests only?
Application.AddMessageFilter(this); | ||
|
||
s_messageProcHook = PInvoke.SetWindowsHookEx( | ||
WINDOWS_HOOK_ID.WH_MSGFILTER, | ||
&MessageProc, | ||
HINSTANCE.Null, | ||
PInvoke.GetCurrentThreadId()); | ||
|
||
s_getMsgProcHook = PInvoke.SetWindowsHookEx( | ||
WINDOWS_HOOK_ID.WH_GETMESSAGE, | ||
&GetMsgProc, | ||
HINSTANCE.Null, | ||
PInvoke.GetCurrentThreadId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't prove that any one of these was a superset of the others, so for now I collect all three.
Span<char> formatName = stackalloc char[256]; | ||
fixed (char* pFormatName = formatName) | ||
{ | ||
int length = PInvoke.GetClipboardFormatName(message, pFormatName, formatName.Length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this function doing, are window messages registered as clipboard formats?
|
||
_form = form; | ||
|
||
lock (this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please introduce a new field to lock instead of this
to encapsulate class details properly?
s_messageNames = messageNames.ToImmutable(); | ||
|
||
DataCollectionService.RegisterCustomLogger( | ||
static fullPath => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this code get exercised when running tests locally?
using var messageRecordService = new WindowsMessageRecordService(); | ||
using var screenRecordService = new ScreenRecordService(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind having these very explicitly visible in the base class.
Could you please add some way to enable message logging on specific tests only?
Related to #10902
Microsoft Reviewers: Open in CodeFlow