我正在修改的 Visual Studio 2008(实际上称为 BIDS)中执行 ac# 脚本(在 SSIS 中,一个 ETL 工具)。我收到一个错误,但错误消息不允许我跟踪导致错误的行。如何找出导致问题的线路。
我尝试使用,尝试捕获并且我的 SSIS 包运行没有错误。但是,当我删除 try catch 时,包执行显示错误。无论如何,所有关于 SSIS 的讨论都不是真正需要的。它的错误/异常捕获在这里很重要。
try
{
//my code here
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught.", e);
}
错误信息如下 -
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at ST_LongCodeNameHere.csproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
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()