Microsoft KB Archive/922647

= You cannot debug assemblies that are referenced in the Script task code by using Visual Studio for Applications in SSIS =

Article ID: 922647

Article Last Modified on 11/20/2007

-

APPLIES TO


 * Microsoft SQL Server 2005 Standard Edition
 * Microsoft SQL Server 2005 Developer Edition
 * Microsoft SQL Server 2005 Enterprise Edition
 * Microsoft SQL Server 2005 Workgroup Edition
 * Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems
 * Microsoft SQL Server 2005 Enterprise X64 Edition
 * Microsoft SQL Server 2005 Standard Edition for Itanium-based Systems

-





INTRODUCTION
Consider the following scenario. You are debugging a Script task in an SSIS package in Microsoft Visual Studio for Applications. You try to step into an assembly that is referenced in the code of the Script task. In this scenario, you receive the following message:

There is no source code available for the current location.

You can click Show Disassembly to view the assembly of the referenced library. However, you cannot debug the assembly.

In Microsoft SQL Server 2005 Integration Services (SSIS), you cannot debug assemblies that are referenced in the Script task code by using Visual Studio for Applications. This problem occurs even if the assembly is loaded in the global assembly cache. This article introduces a method that you can use to debug the assemblies that are referenced in an SSIS Script task by using a separate instance of Visual Studio 2005.



MORE INFORMATION
To debug assemblies that are referenced in the code of a Script task, you must open an instance of Visual Studio 2005, and then attach the debugger to the Script task process. To do this, follow these steps.

Note To enable the assembly that is being debugged outside the Scrip task process, you must disable the Enable Just My Code (Managed only) option in Visual Studio 2005 before you build the assembly. For more information about how to disable this option, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/85yzd16c.aspx

  Break the process of the Script task before you step into the call of the referenced assembly. To do this, add a code to display a message box in your Script task code. The following code example illustrates how to do this. MsgBox(&quot;Continue&quot;) x = YouClass.YourMethod(variable)  Run the SSIS package. When the execution is paused at the MsgBox call, do not click the OK button, and then open a new instance of Visual Studio 2005. In Visual Studio 2005, open the source file of the class library. The file may be a .cs file or a .vb file, depending on which language you used to write the class library. In Visual Studio 2005, click Attach to Process on the Debug menu. In the Available processes list, click the row where the Process column value is DtsBebugHost.exe and the Title column value is Script Task, and then click Attach. When the modules have been loaded, examine the output window to make sure that the symbols of the referenced assembly have been loaded.

If the symbols are loaded successfully, you will see a message that resembles the following in the output window:

'DtsDebugHost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\ \1.0.0.0__848b89cbc77872dd\ .dll', Symbols loaded.

 In Visual Studio 2005, set the breakpoints in the source file for the referenced assembly.</li> Continue to run the SSIS.</li> In the message that you received in step 2, click OK.</li></ol>

To reference an assembly in the code of a Script task, you must copy the assembly to either the %windir%\Microsoft.NET\Framework\v2.0.xxxxx folder or the %ProgramFiles%\Microsoft SQL Server\90\SDK\Assemblies folder. The assembly must also be signed with a strong name and installed in the global assembly cache. For more information, visit the following MSDN Web site:

http://msdn2.microsoft.com/en-us/library/ms136007.aspx

<div class="references_section">