How to set a breakpoint in every MessageBox in my application?

How to place a breakpoint in every MessageBox in my application?

+3
source share
6 answers

In the Visual Studio IDE, select the menu Debug->New breakpoint->Breakpoint at Function...

Fill in the function field with the text "MessageBox".

bkpoint.png

+10
source

Write a wrapper function around the MessageBox, replace all of your calls to MessageBox with this wrapper function, place a breakpoint inside your wrapper function.

+4
source

Debug > New Breakpoint > Break on function. . , . , VS , , . . System.Console.WriteLine .

, , VS WriteLine, , , , VS . , , .

+2

It may not be possible, but if you find and replace your MessageBox call and add a call (before the MessageBox is called) to the function where the breakpoint is inserted, you can step on it.

0
source

You can find and replace:

replace

.ShowDialog();

from

.ShowDialog();
#ifdef dialogDebugging
System.Diagnostics.Debugger.Break();
#endif

Then define dialogDebugging in your project settings.

0
source

Press ctrl-F to open the search dialog. Search for MessageBox.Show Right-click a line of code and select a breakpoint → Insert Breakpoint

-1
source

Source: https://habr.com/ru/post/1716293/


All Articles