38

I am working on an SSIS package. The package has a script (C# language) task. I need to debug the script task. I set the break point. The script in script editor (Visual Studio) and the task in SSIS package editor, both, show break point in red color - means the break point is enabled. However, when I debug the package the break point does not hit.

The break point has no conditions on it, so I expect it to hit every time the package runs.

I am using Visual Studio 2008 on Windows 2003 R2 64-bit SP2.

5
  • What happened why you tried to run the package, the script task executed successfully or not? Commented Jan 4, 2017 at 19:18
  • @LONG yes the script executes successfully when I run the package. Commented Jan 4, 2017 at 23:55
  • any Try..Catch block? Commented Jan 5, 2017 at 2:02
  • @Long no try..catch. I simplified the script eliminating all other logic to just append few hard coded strings to a StringBuilder instance. Commented Jan 5, 2017 at 19:03
  • This was my issue, and it must be a bug! developercommunity.visualstudio.com/content/problem/349680/… Commented Jul 23, 2019 at 19:28

17 Answers 17

64

After more research and trial-error, found that the SSIS package ignores the breakpoints in a Script Task when debugging on a 64-bit machine. To fix it -

  1. Go to the Solution Explorer
  2. Right click your SSIS project node > Properties
  3. In Configuration Properties > Debugging > Debug Options > Set Run64BitRunTime to False.

SSIS Project configuration settings

After making this change, the breakpoints hit like magic.

Sign up to request clarification or add additional context in comments.

4 Comments

There are a whole lot of different permutations of all the suggestions in this thread, but I'm able to debug fine using the 64-bit runtime (but I am building the script task as x86, per below).
uh no they dont
I've had this issue forever. This finally worked for me! Thanks!
I have VS2019 (ver. 16.11.43) and there is still issue with this as of 2025. But your solution works for me (switch Run64BitRuntime to False), but also works: replacing all "Something {Variable} rest of text" with "Something " + Variable + " rest of text"
41

I tried all the answers provided here with no success (using VS2015). After some more searching I found this question that is actually an answer which stated that newer C# features / syntax were causing the debugger to not fire correctly.

In their example (and also mine) using string interpolation was causing the breakpoints to not be hit.

Replacing

$"{someVariable} - {someOtherVariable}"

with

string.Format("{0} - {1}", someVariable, someOtherVariable);

did the trick for me.

EDIT

It appears this issue has now been fixed with SQL Server Integration Services Projects, but you need to be running VS2019 to download it.

5 Comments

It didn't like string.join either in VS 2015.
This works for me. Thank you for sharing your finding. :)
It seems that all the efforts here are taking stabs and sometimes working and sometimes not. Thank MS as @PTD said the SQL Server Integration Services Projects update fixes this problem. In order to install it though I needed to update my VS 19 first using the VSIX (Visual Studio Installer). His response should be the chosen answer...
You're a genius! You just saved me useless hours of pulling my hair out. Thank you, thank you!
Thanks Man, I have been using VS2022 for SSIS, but break points never hit. I downloaded VS2019 and downloaded SSIS extension for VS2019 and now debugging is working
15

Update: Guys, I againg lost any ability to set breakpoints (a request to MS)
My previous fixes are below.
Now I'm using logging and tracing instead of debugging.


C# new features (after C# 4.0) are blamed for killing debugging of the SSIS Script Task.

To return the breakpoint capability I do the following.

  1. Remove C# new features
  2. Run my Script Task once, successfully. I.e. without a crash.
  3. Reopen the Vsta Project from my Script Task and put breakpoints there.

At the end, you have to see a red circle on your Script Task.
(Tested in VS 2017.)

enter image description here

Note. I have to mention that debugging works even if your use "Execute Task" only, not "Execute Package"!

Remove C# new features

To remove the C# new features, I can advise you two ways.

First, restrict Vsta Project properties to C# 4.0 (migrated packages may not support this).

  1. Dobule click your "Script Task" to open "Script Task Editor".
  2. Click "Edit Script..." button to open Visual Studio.
  3. In "Solution Explorer" select the project and click the F4 key on your keyboard.
  4. In opened "Properties" window in "C# Language Level" choise "C# 4.0"
  5. Build your project and fix compilation errors.

Secondly, Vsta Projects in old/migrated packages may not show the above "C# Language Level" property.
So you can put your code in a fake project in Visual Studio 2010 and compile it there.

Run it once successfully

After you fix your C#, you have to run your Script Task once successfully.
You may want to put the return statement at the beginning of the Main() method to prevent any real execution.
Sorry, this doesn't always work and I don't realise why but you definitely need to fix your C# in the first place.
At least you will get a working Script Task and can debug it in an old fashioned way (logs by Dts.Events..., exceptions, etc.)

TL;DR

It looks like I even got severe cases when C# new features forced Script Tasks to fail silently with a success completion status.

As an example, add the following to your Script task.

string Bug { get; } // Only getter properties.
//...
var str = $"Now is {DateTime.Now}"; // String Interpolation in C#
//...
var dummy = val?.ToUpper(); // ?. and ?[] null-conditional Operators

And workarounds for this non-complete list:

string Bug { get; set; }
//...
var str = string.Format("Now is {0}", DateTime.Now);
// etc.

What I also do, I build my C# code in Visual Studio 2010. It simply doesn't compile the new .NET features and do not allows .NET Framework versions above 4.0. So far, so good.

Of course, other answers from this SO-question didn't help me.

1 Comment

Note that this hase been fixed in Version 3.2 Preview (2019-11-05) marketplace.visualstudio.com/…
9

In my case, none of these solutions worked. I finally got to know that the Resharper was culprit. After uninstalling it, it started working like charm.

3 Comments

Indeed, seems to be a registered issue on the Jetbrains support forum. Disabling resharper fixed it for me too. Didn't try unchecking debug options yet within resharper.
Disabling only the debugger integration of Resharper also works. ReSharper -> Options -> Products & Features and then unticking the "Debugger integration" box.
Yup...why does it take multiple times to tell me something before I remember it?! This was my issue as well.
8

In my case, I had to get rid of all features from C# 6: string interpolation, null conditional operators (?., ?(), ?[]) and expression-bodied members (=>) (there might be more in your case). You can check them all here. Of course, the same applies to C# 7 features.

The 32/64 bit changes from other answers didn't help, so I rolled back those and the debugging kept working just fine.

3 Comments

And for me, I had to do both: change the target platform to x86 and remove the string interpolation.
In my case, verbatim string literal and interpolated strings was the culprit string query = $@" very long string with new lines...
That was what solved the issue here. Thanks a million I started going mad…
5

Use System.Diagnostics.Debugger class to add breakpoint programmatically:

System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();

You can check if the debugger is attached or not:

    if (System.Diagnostics.Debugger.IsAttached)
        System.Diagnostics.Debugger.Break();

Follow these step:

  1. Keep your project or solution opened.
  2. Run your app to hit breakpoint.
  3. Select your project in Just-In-Time Debugger.Just-In-Time Debugger snapshot

2 Comments

Thanks. I tried these. I would get a message box saying user breakpoint reached but would not let me step through the code.
Open your project before run your app.Then select your project in Just-in Time debugger.
5

I inherited an SSIS package where unfortunately the above answers didn't help.

In the end I found the script task's build properties for debug mode had had the optimize code ticked. Make sure this isn't ticked because for me visual studio would fire up for script debugging and close shortly after without breaking at all.

Make sure Optimize code is not ticked

Pretty obscure but worth a mention.

1 Comment

Anyone have this issue using VS 2022? I can select False for Run64BitRuntime
5

We hit the same problem recently. For us the solution was to ensure that the script task project was marked to run as with the platform target set to x86.

  1. Edit the script task
  2. Click on the project and select properties
  3. Select to set the platform target to x86

1 Comment

This fixed it for me, and also resolved the following warning I was getting in the Error List: "MSB3270: There was a mismatch between the processor architecture of the project being built..." learn.microsoft.com/en-us/visualstudio/msbuild/errors/msb3270
3

I spent whole day on this and NONE of the solutions mentioned here worked for me.

In my case, the existing project was targeted to SQL Server 2016 which defaults ScriptLanguage Microsoft Visual c# 2015. This doesn't allow debugging in VS 2019. I have to target project to SQL Server 2019 to make debugging work. Of course, I am not going to checkin version change. It's only to debug script. Once script is working, I am going to revert target version to SQL server 2016.

Hope this saves time for someone.

Comments

2

In addition to Jeff's suggestion, also change the Platform Target to "x86" (In the script's properties' Build tab. This FINALLY got me debugging again on a 64-bit system.

Comments

1

Microsoft released an update v3.2 of SQL Server Integration Services Projects where it resolves the issue with Roslyn and other C# language features introduced after .Net 4.5. C# features.
Bad news - this fix is for Visual Studio 2019 only, you have to upgrade your VS to use it.

Comments

1

I had the same problem as you @PAS. Using VS 2019 and Target server version 2016. Just found out that if upgrading SSIS in Visual Studio (going into Extensions->Manage Extensions) to latest version (which now is 3.15) debugging is now working.

Comments

0

My breakpoints refused to hit no matter what I did. I ended up debugging and fixing the issues just using exception throws. Once I had fixed the issues I was having, the breakpoints started hitting!

So my breakpoints would only hit once the code did not experience any runtime issues... which is bizarre.

Comments

0

In my experience, it doesn't matter:

  • if Run64BitRuntime is true or false
  • if you build the 32 or 64 bits version of your package

But there is something very important, not mentioned in any other answer: you must run the whole package. If you run a Task or a Container the breakpoint will be ignored.

I'm using Visual Studio 2013, on a 64 bits machine.

Comments

0

I only had one Script component were no breakpoints were hit (I was doing some CRM stuff without needing source/target). I trid to add a Source componenet with a simple fetchXML (even if I didn't needed it). Then it worked! :-)

Comments

0

I found out that by copying a Script Component task, the VSTA project as a whole is copied as well. This is what you would expect, but what I did not expect is with that, the assembly name for example is also copied. Running then Execute Task works fine, but running the whole package actually only runs the first script that was copied and resulted in exceptions being thrown before ever hitting the row processing function. That was also the reason for me that breakpoints were not being hit.

Comments

0

Hope my experience can help.

Here is my scenario. I have VS2022 with SSDT. My SSIS project work properly and able to hit Breakpoint of Script task. However, it failed to start after upgraded to VS2022 V17.13.2. I have tried all solutions mentioned above, but still not able to start the debugging in VS2002.

Finally, I solve it by uninstall the SSIS Extension and reinstall it again. The breakpoint in Script task can be hit again in debugging mode. Here is the steps:

  1. Start VS2022 and click "Continue without code"
  2. Click "Extensions" and "Manage Extensions"
  3. Find "SQL Server Integration Services Project 2022" in "Installed", and then click "Uninstall"
  4. Restart computer
  5. Start VS2022 and go to "Manage Extensions" again
  6. Search "SQL Server Integration Services Project 2022" in "Browse"
  7. Click "Install", download latest SSDT and install again.

Hope this solution can help. Good luck.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.