Why Break points doesn't hit in ssis package task script? - sql-server

I'm developing a ssis package that consist of multiple task scripts and sql tasks,i'm wondering where did i make a mistake that in one of the task scrips nowhere breakpoints hits,in other scripts break points work fine and the issue only persist in one task script.
Please consider following tips Before judging and present your possible solution :
1.There is no error where i build task script
2.Script is responsible for calling a web service
3.I'm pretty sure that script runs because i used MessageBox.Show() and traced request through codes.
4.I'm using visual studio 2015 and sql server 2016.

I found it by accident !
this piece of code was source of the issue !
if(res?.Code=="0")
{
...
Apparently script was not compatible with this syntax and would cause a kind of misunderstanding for ssis and could not debug code!
?. Access method was not familiar for ssis !
I replaced that line by Following one:
if(res !=null && res.Code=="0")

Related

SSIS - package works in VS, fails with "Failed to compiled scripts contained in the package". There are no script objects in the package

VS2017, Deploy to SS2016. Package runs without any errors from VS. Project deployment to a server that previously had package deployments only - we're moving to project deployment, and DBAs said to use that.
Getting many errors like:
Get Error Information:Error: Failed to compiled scripts contained in the package. Open the package in SSIS Designer and resolve the compilation errors.
The package has absolutely no script objects. I've checked with the package explorer, and there isn't even a scripts section. To verify, I added an empty script, and then the explorer did show that section.
Other info: Package deployment is new to our DBAs. They are completely mystified by this, and other errors, like:
Get Error Information:Error: CS2001 - Source file 'C:\Windows\TEMP.NETFramework,Version=v4.0.AssemblyAttributes.cs' could not be found, CSC, 0, 0
My opinion, unexpert in SSIS as I am, is that these servers are not set up or configured properly in some way, but I am out of my depth in this, and DBAs are floundering. What might I do to get to the root of this?
I ended up side-stepping the issue by essentially recreating the package. Even XML search revealed no scripts, so the assumption was some kind of corruption. The package was recently upgraded to package-deployment - perhaps that action had a hand in the problem.
We had the same issue and isolated the problem to a Script Task (regardless of language) that existed in a Sequence Container. Placing the Script Task outside the Sequence Container, and upgrading the package to 2016 worked. The package was originally 2012 (as far as I can see) and the server side SSIS was 2016 13.2.5426.0. We were using VS 2017 as well.
For me this was happening because I was targeting the wrong database version. in your SSIS Package project go into properties and set the TargetServerVersion appropriately And then recompile the project and redeploy to sql server.

SSIS Error - No object exists with ID 0

I deployed an SSIS 2016 package last week after updating an SQL statement. I deployed by simply right clicking the package in MVS and choosing deploy.
It's run properly for the last week, but last night we got errors. The error description is simply No Object exists with ID 0.
I took a quick look at my code, and there's a Script Transformation that calls C# with PipelineVersion==0. It's part of an error handler so, it wouldn't be called regularly. Could this be the cause of my error?
And what can I do in my deployment to avoid this error?
So, I was able to resolve the issue by opening the script, rebuilding it, and rerunning the SSIS.
I'm wondering if there's anything that can be done to avoid this issue in the future. It makes me look pretty bad to the client when this happens in production.

Cannot debug a script task

I exported a package from the production server (.ispac) to my local computer and opened in SQL Server Data Tools 2015 since I need to make some changes in the work flow. This package also include a script task which I need to alter and debug.
I added a break-point in the code, the problem is that when I run the package from Data Tools, VS 2015 opens but the below error is show and VS 2015 closed immediately and therefore I an not able to debug the code.
I have been trying to solve this for a couple of hours and viewed various post but no success.
I already: Set Run64BitRuntime = False
If I remove all the breakpoints and run the package all tasks will succeed but the script task is not doing what it is intended for... (this is why I need to debug).
I am stuck and not able to fix the code!
This is a reference issue. The references (dll's) version on your production server are different from the installed dlls on your loxal computer.
Try removing all reference used inside the script task and adding them again.
useful links
https://mitchellpearson.com/2015/04/13/upgrading-script-tasks-in-ssis-target-of-invocation-on-script-task/
DTS Script Task Runtime Error: Exception has been thrown by the target of an invocation
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/78373e2b-b4ea-4ce2-9590-b624a284d538/runtime-error-exception-has-been-thrown-by-the-target-of-an-invocation-from-script-task?forum=sqlintegrationservices
"Runtime error Exception has been thrown by the target of an invocation" from Script task

SSIS package runs in Visual Studio but fails when executed from SQL Agent [duplicate]

This question already has an answer here:
Why does my ODBC connection fail when running an SSIS load in Visual Studio but not when running the same package using Execute Package Utility
(1 answer)
Closed 7 years ago.
Using SQL Server 2014 with Visual Studio 2013 Shell. Relatively new to using SSIS but have had success with creating and executing other packages.
I'm having an issue with one SSIS package in a project running without failing in the first few seconds of the job being kicked off by the SQL Server Agent. I have other packages in the same project that are scheduled and run as schedule with no issues.
The package in question runs with out any issues in Visual Studio, but when it is deployed it will not run. The package details are:
it runs an FTP task to pick up a Excel file from a remote FTP server
then runs a Execute SQL Task to truncate a table
then runs a Data Flow Task that loads the table with the data from the file that was just picked up.
Again this all works fine without errors in Visual Studio. Looking the debug logs in VS there are not even any warnings and takes a little over a minute to run.
I have rebuilt the package in a new package deployed it and it again won't run when deployed, same results. When the deployed package is run it fails right away within 4-15 seconds which is not enough time for it to download the file.
I have other packages doing similar tasks that are deployed and working just fine.
I've seen a couple of things in my searching for a solution but don't think they apply here:
There is only one user (me) and I have a proxy setup for SSIS Package Execution which is the same for all the packages. So I don't think it is a security issue.
The Access Database Engine 2010 (redistributable) installed, ACE I believe I seen it referred to. So I don't think it is an issue with drivers.
Anyone able help guide me in where I should be looking or what the issue might be? Any additional information needed? Much appreciated.
EDIT: Additional information from the log file for this job:
-1071611876 (Data Code)
SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0209303. There may be error messages posted before this with more information on why the AcquireConnection method call failed.
Data flow engine has finished a call to a component method. : 122 : Excel Source : AcquireConnections : 130832947393433501 : 130832947395273663
-1073450985 (datacode)
Excel Source failed validation and returned error code 0xC020801C.
One or more component failed validation.
There were errors during task validation.
So it was the 32-bit run time box needing to be checked in the SSA Job Step Properties Advanced tab. I think I might have saw that some place but figured it wouldn't apply since SQL Server, Office/Excel and ACE are all 64-bit in my system. But I guess Microsoft hasn't gotten around to making all the drivers 64-bit. Thanks for the help.

How I know any particular one command is failed while deploying/publishing data in Database?

I have created database project in visual studio 2013. Project build successfully . In this project I have inserted some test data in post deployment. If any data failed to insert then how can know the one of script is failed at particular location.
Actually I want to rollback all the thing if any command is failed from script file itself. Since SQL Server 2012 is not supporting rollback from pre/post deployment script.
The result window will give you the line and details of any error, it is a bit annoying as it will sometimes show the text of the beginning of the script but the error line number will be correct.
General things you should do is to make sure your insert scripts are re-runnable and then if you really can't see the error you can run the script yourself to debug it.
I would really recommend using MERGE statements to do the inserts :)
I also generally recommend using sqlpackage.exe to push to local Deb instances rather than the vs publish, see:
https://the.agilesql.club/blog/Ed-Elliott/Visual-Studio-SSDT-Publish-My-Personal-Best-Practices
Ed

Resources