Breakpoint debugging without source code DLL using the vs.net plug-in of reflector

Source: Internet
Author: User
Tags reflector

. NET programming tool reflector can decompile applications and DLL developed based on. NET, which has powerful functions. Today, I want to test the function of using the vs.net plug-in breakpoint to debug external DLL without source code (as long as it is an assembly, so EXE can also be used.

 

I. Load the reflector plug-in of vs.net

The vs.net plug-in is included in the reflector program downloaded from the official website (the latest version is 6.1.0) and is named "Redgate. reflector. addin. DLL, open red gate's. net reflector program, select Tools> integration options to open the integration Options dialog box, which supports the development environment of vs2005/2008/2010, it will automatically determine which development environments are installed in the current system. If a development environment is unavailable, the corresponding options will be automatically grayed out and prompt "not installed on this computer ". This article uses vs2008 for testing. Therefore, select Visual Studio 2008. Click OK to automatically install the plug-in for us. After installation, the. NET reflector top-level menu and right-click menu will be added to the Development ide of vs2008.

Note: Once the plug-in is installed, the location of the reflector program cannot be moved. Otherwise, when the vs.net development environment is started, a message indicating that the plug-in has been removed and the plug-in must be reconfigured.

 

2. Create a DLL demo program

Use vs2008 to create a very simple DLL. The Code is as follows:

Namespace dlldemo

{

Public class test

{

Public String sayhello (string name)

{

String message = "hello," + name;

Return message;

}

}

}

Iii. decompile the dll demo code and start breakpoint debugging

1. create a new call Program Project (reflectortest. SLN), and then select the menu. net reflector-> choose assemblies to debug, the Select Assembly dialog box appears, the currently loaded.. NET Framework namespace. deselect all because you do not want to debug the code in the framework. Click the browser button in the lower-left corner to view the DLL: dlldemo developed in step 2. DLL ,. net reflector will automatically start decompilation. If the select Assembly dialog box is opened again after the end, we select the dlldemo. dll appears in the list and is selected, as shown in:

 

2. In the newly created Project, add the DLL reference developed in step 2 and add the following code:

Namespace reflectortest

{

Class Program

{

Static void main (string [] ARGs)

{

Dlldemo. Test test = new dlldemo. Test ();

String message = test. sayhello ("Roger ");

Console. writeline (Message );

Console. Readline ();

}

}

}

3. in the preceding string message = test. sayhello ("Roger"); sets the breakpoint and runs the program. When this line of code is running, press F11 and perform one-step debugging To Go To The dlldemo decompilation code. In IDE, the test class code page is read-only, that is, decompilation code.

 

Postscript:

1. The latest version of. net upgrade of vs.net is activated. In the activation window of the upgrade gate's. Net reflector, ensure that redgate.licensing.exe is enabled.

2. Red Gate's. Net reflector there are many plug-ins available, specific can refer to the following url: http://reflectoraddins.codeplex.com/

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/roger_ge/archive/2010/04/11/5472731.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.