1

edit:
I don't have source code, and someone says that one would need to have debug files to step in. So, I don't know it's true or not,so I will still ask this question


In VS, I am trying to Attach To Process to external application to find out, what method (with parameters) is fired on specific button-click.

Per this solution, before I click button, i pause execution and click make "Step In", however, button click is not being caught.

Video: https://files.fm/u/2wf4gjxb (neither checking Enable just my code option helps, not unchecking it. Also, it doesn't have any pdb(screenshot), so i assume it is being considered as external code)

Afaik, the window should be WPF (but someone in comment said, it look slike WinForms). Even WinSpy (or alike) programs are unable to detect buttons when I try to inspect the elements on that window. What should I try?

大陸北方網友
  • 3,696
  • 3
  • 12
  • 37
T.Todua
  • 53,146
  • 19
  • 236
  • 237
  • @Crowcoder well, i don't know how to do that ( i am a bit new to the VS debugging), specifically i dont know how to find out button-event handler at all. that is external app i dont have any source-code. – T.Todua Jul 20 '20 at 12:40
  • The Window does not look a WPF window at all... It’s WinForms. – Legacy Code Jul 20 '20 at 12:43
  • Yes because WPF is direct2D and does not use handles for every control. – Legacy Code Jul 20 '20 at 12:51
  • @Schwarzie2478 I've updated my question to answer your question. so, you can delete the comment now safely. If i have to post further information, let me know... thanks – T.Todua Jul 20 '20 at 12:53
  • 1
    If it’s WPF you can use snoop https://archive.codeplex.com/?p=snoopwpf to check the button for its binded command or click event. – Legacy Code Jul 20 '20 at 13:00
  • @T.Todua if it does not solve your problem then there is no reason to upvote. Try it first... If it helped you, buy me a beer. – Legacy Code Jul 20 '20 at 13:14
  • @LegacyCode well, i am getting the exception when i tried that program: `Unhandled Expection: The calling thread cannot access this object because a different thread owns it`. btw, even though upvotes/answer-marks work here , i will do what you want and buy a beer ; ) – T.Todua Jul 20 '20 at 13:16

2 Answers2

1

You could first try to decompile the code you are trying to debug: This can be done at low level with ILSpy ( open source). But there is an extention for ILSpy in Visual studio. I would suggest you take a look at the following link from Microsoft about how to go about debugging third party assemblies: microsoft documentation

As suggested by @Legacy Code , you could go for the easier to use decompiler: dnSpy. You can attach to a process there to and have the code be decompiled.

If the creator added some attributes to block this, it get's a lot harder fast. Recompiling the decompiled code yourself and using those assemblies and such...

Schwarzie2478
  • 2,186
  • 26
  • 30
1

You can try my Runtime Flow tool. If it is indeed a .NET application, you will see method calls with parameters on the button click.

Sergey Vlasov
  • 26,641
  • 3
  • 64
  • 66