1

My question is that how can we debug a .dll script written in C#?

I have created a .dll for an .exe program and I am getting error and I want to debug it but enable to do so. I can easily debug a standalone program but don't know how to debug script for other program.

The program is full screen application (it is a PC game). And I am using SharpDevelop IDE (no plugin installed yet, pure vanilla as downloaded from main site)

And yeah I want to tell you that I am not doing anything like stealing game or something like that which can hurt game developer piracy. Just modding for personal use and it is allowed by developer for single player mode.

Maybe that all information you need. I am sorry for my bad English, this is my first question in stack overflow and I am not very genius, just learning C#.

And thank you.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Aryan
  • 41
  • 5
  • 1
    Your English is alright, don't worry about it. I assume you don't have the source of the DLL, just the compiled library? – Aleksander Lidtke Sep 15 '15 at 14:56
  • Unfortunately this is a very broad question; too broad for Stack Overflow. Are you able to condense your question down to what you've tried so far and what you are having trouble with? – David L Sep 15 '15 at 14:58
  • Maybe try using .net reflector? https://www.red-gate.com/products/dotnet-development/reflector/ – Mark Sep 15 '15 at 14:58

2 Answers2

1

First of all C# is not a Scripting Language since it's compiled to CIL and not Interpreted during runtime like python does.

In order to debug a .dll or an .exe you need few things in addition to the debugger itself:

  • A source code file.
  • A .PDB file matching to the .exe/.dll and the source.

Both things can be manually generated if you don't have them using Reflector or DotPeek and probably other programs.

Debugging for external processes in Visual Studio is possible by:

  • Attach to process (CTRL+ALT+P in Visual Studio) for a running process.
  • Start Extrnal Program in the project properties' Debug section.
  • Setting a specific flag in the registry using corflags or manually.
  • Using remote debugger if have to.

You can search about every one of them a lot since it is really an infinite topic but I hope you get the basic ideas from the answer, feel free to ask if not.

Tamir Vered
  • 10,187
  • 5
  • 45
  • 57
0

Have you tried "Attach to process"?

In SharpDevelop I believe the steps are (don't have it installed on this machine):

  1. Run the exe and then al+tab out
  2. Navigate in top menu to Debug > Attach to process...
  3. In the window that appears find the running process of the exe and click Attach

If you are looking to decompile check out this question: How do I decompile a .dll file?

Community
  • 1
  • 1
Devon Burriss
  • 2,497
  • 1
  • 19
  • 21