Hi when I building solution it's fine but during execution its fail with following error:
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()
I will mention that I successfully run it in SSIS
with JavaScriptSerializer Deserializer
.
Not sure what I am doing wrong?
Add external references for this class .Net40
(for SQL
Server 2012
seems right).
Any suggestion?
Code sample below:
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
// dataResponse looks like that {"access_token":"bla","expires_in":222}
// Old Code
// JSONElements elements = new JavaScriptSerializer().Deserialize<JSONElements>(dataResponse);
JSONElements elements = JsonConvert.DeserializeObject<JSONElements>(dataResponse);
}
public class JSONElements
{
public string access_token { set; get; }
public int expired_in { set; get; }
}