I am running a package in SSIS in VS 2013 BIDS. There is a script that is part of a Trigger API task in the SSIS project. When the task is run the following error is shown:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
The C# script is:
public void Main() { var webGet = new HtmlWeb(); var document = webGet.Load(Dts.Variables["User::processUrl"].Value.ToString()); var status = document.DocumentNode.SelectSingleNode("//div[@class='alert alert-success alert-dismissible']"); // MessageBox.Show(status.InnerText.ToString(), "Error Title", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); if (status.InnerText.Trim().Contains( Convert.ToString("Query ran successfully.")) ) { Dts.TaskResult = (int)ScriptResults.Success; } else { Dts.TaskResult = (int)ScriptResults.Failure; } }
The Namespaces used are (.NET 4.5 references)
using System; using System.Data; using Microsoft.SqlServer.Dts.Runtime; using System.Windows.Forms; using System.IO; using System.Net; using HtmlAgilityPack; using System.Linq;
The error message fires on the line:
var webGet = new HtmlWeb();
I am trying to decipher the error message to use in troubleshoot the script. Any help would be appreciated.