cancel
Showing results for 
Search instead for 
Did you mean: 

Overlapping window log error when window has been handled by event handler

SOLVED
New Contributor

Overlapping window log error when window has been handled by event handler

I'm currently handing an overlapping window using the project's event handler and after it exits I still get an error in the log. As far as I can tell the object still exists, but it is no longer visible. I was hoping for a way to not post the error to the log because it has been sufficiently handled for my test.

 

For anyone interested in trying to reproduce this:
Open an "older" version of VS 2019 (I'm currently using 16.0.3 with 16.0.4 available) and wait for the toast window in the bottom right hand corner to appear telling you that there's a newer version available.

Create a C# winforms project.

Add a textbox control to the form.

Attempt to interact with any property of the control in the properties window behind the toast window.

You'll generate the overlapping window event.

Inside the overlapping window event handler run

Sys.WaitProcess("devenv", 500).Find("Name", "*HwndSource: ToastWindowRoot*", 5).Find("WPFControlName", "IgnoreButton", 8).Click(); // To click the close button on the window

Delay(5000); // To prove that it's not a timing issue

The toast window object still exists, but doesn't appear on the Visual Studio window. You'll still get an error in the log saying there was an overlapping window.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Overlapping window log error when window has been handled by event handler

Right... the code for the handler doesn't REMOVE the OverLapping window error, it just handles the overlapping window so it doesn't "blow up" your automation.

What you need to do, to suppress the message, is that if that object exists and is present, call your code you already have AND add a call to LogParams.Locked = true;

 

That will suppress the log message while still handling the window.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
2 REPLIES 2
Community Hero

Re: Overlapping window log error when window has been handled by event handler

Right... the code for the handler doesn't REMOVE the OverLapping window error, it just handles the overlapping window so it doesn't "blow up" your automation.

What you need to do, to suppress the message, is that if that object exists and is present, call your code you already have AND add a call to LogParams.Locked = true;

 

That will suppress the log message while still handling the window.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Highlighted
New Contributor

Re: Overlapping window log error when window has been handled by event handler

Gave that a shot and it worked great. Thanks!

New Here?
Join us and watch the welcome video:
Top Kudoed Authors