Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Log windows messages in tests #10916

wants to merge 1 commit into from

Conversation

sharwell
Copy link
Member

@sharwell sharwell commented Feb 20, 2024

Related to #10902

Microsoft Reviewers: Open in CodeFlow

Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Attention: Patch coverage is 68.75000% with 50 lines in your changes are missing coverage. Please review.

Project coverage is 73.19639%. Comparing base (43e433b) to head (c50e97e).
Report is 383 commits behind head on main.

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     
Flag Coverage Δ
Debug 73.19639% <68.75000%> (+0.57432%) ⬆️
integration 19.45555% <ø> (?)
production 47.60859% <ø> (+3.99596%) ⬆️
test 94.98237% <68.75000%> (-2.39303%) ⬇️
unit 44.49480% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@dotnet dotnet deleted a comment from azure-pipelines bot Feb 20, 2024
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 20, 2024
@dotnet-policy-service dotnet-policy-service bot added the draft draft PR label Feb 20, 2024
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 22, 2024
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 22, 2024
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 22, 2024
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 22, 2024
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 22, 2024
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 22, 2024
@dotnet dotnet deleted a comment from azure-pipelines bot Feb 22, 2024
@sharwell
Copy link
Member Author

I can't get this to fail. I tried.

@sharwell sharwell marked this pull request as ready for review February 22, 2024 18:35
@sharwell sharwell requested a review from a team as a code owner February 22, 2024 18:35
Comment on lines +296 to 297
using var messageRecordService = new WindowsMessageRecordService();
using var screenRecordService = new ScreenRecordService();
Copy link
Member Author

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.

Copy link
Member

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?

Comment on lines +143 to +155
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());
Copy link
Member Author

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.

@dotnet-policy-service dotnet-policy-service bot removed the draft draft PR label Feb 22, 2024
@lonitra lonitra added the waiting-on-team This work item needs to be discussed with team or is waiting on team action in order to proceed label Feb 26, 2024
Span<char> formatName = stackalloc char[256];
fixed (char* pFormatName = formatName)
{
int length = PInvoke.GetClipboardFormatName(message, pFormatName, formatName.Length);
Copy link
Member

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)
Copy link
Member

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 =>
Copy link
Member

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?

Comment on lines +296 to 297
using var messageRecordService = new WindowsMessageRecordService();
using var screenRecordService = new ScreenRecordService();
Copy link
Member

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?

@Tanya-Solyanik Tanya-Solyanik added 📭 waiting-author-feedback The team requires more information from the author and removed waiting-on-team This work item needs to be discussed with team or is waiting on team action in order to proceed labels Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📭 waiting-author-feedback The team requires more information from the author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants