Debugging Custom Assemblies
The Microsoft .NET Framework provides several debugging tools that can help you analyze your custom assembly code and locate errors in it. The best tool to use will depend on what you are trying to accomplish. This example uses Microsoft Visual Studio 2005.
The recommended way to design, develop, and test custom assemblies for Reporting Services is to create a solution that contains both your test reports and your custom assembly.
Procedures
To debug assemblies using a single instance of Visual Studio
Create a new report project using Visual Studio.
At the time you create a report project, Visual Studio also creates a solution to contain it.
Add a new Class Library project to the existing solution. Make sure that the report project is set as the startup project. For more information about how to accomplish this, see your Visual Studio 2005 documentation.
In Solution Explorer, select the solution.
On the View menu, click Property Pages.
The Solution Property Pages dialog box opens.
In the left pane, expand Common Properties if necessary, and click Project Dependencies. Select the report project from the Project drop-down list. Select your assembly project in the Depends On list.
Click OK to save the changes, and close the Property Pages dialog.
In Solution Explorer, select your custom assembly project.
On the View menu, click Property Pages.
The Project Property Pages dialog box opens.
In the left pane, expand Configuration Properties, and click Build if you're in a C# project or Compile if you're in a Visual Basic project.
On the Build/Compile page, enter the path to the Report Designer folder. By default, this is C:\Program Files\Microsoft SQL Server. Server\90\Tools\Binn\VSShell\Common7\IDE) in the Output Path text box. This builds and deploys an updated version of your custom assembly directly to Report Designer before your report is executed.
Once you have designed your report and developed your custom assembly, set breakpoints in your custom assembly code.
Run the report under DebugLocal mode by pressing the F5 key. When the report executes in the pop-up preview window, the debugger hits any breakpoints that correspond to executable code in your assembly. Use F11 to step through your custom assembly code.
To debug assemblies using two instances of Visual Studio
Launch Visual Studio .NET 2005 and open your custom assembly project.
Build the project, and deploy your custom assembly and the accompanying .pdb file to the Report Designer. For more information about deployment, see Deploying a Custom Assembly.
Open up a report project that uses your custom assembly while leaving your custom assembly code open in a separate instance of Visual Studio.
Navigate to the instance of Visual Studio that contains your custom assembly project and set some break points in your code.
With the custom assembly project still the active window, click Process on the Debug menu.
The Processes dialog opens.
From the list of processes, select the devenv.exe process that corresponds to your Report Project and click Attach. When the Attach to Process dialog opens, make sure that the program type Common Language Runtime is selected, and then click OK.
Define the expressions that you will use in your report from your custom assembly and design your report.
When you are finished designing your report, click the Preview tab.
The report executes, and the custom assembly code should break at your predefined break points.
[!참고] Using the Preview tab does not enforce code permissions for the assembly. For a complete test, which includes any code access security errors, start the report project under the DebugLocal configuration setting.
Step through your code using the F11 key. For more information about debugging using Visual Studio, see the Visual Studio 2005 documentation.
Change History
Release | History |
---|---|
2006년 7월 17일 |
|
참고 항목
관련 자료
Using Custom Assemblies with Reports