Reputation: 21
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; }
}
Upvotes: 1
Views: 738
Reputation: 11
Try Replacing
JsonConvert.DeserializeObject<JSONElements>(dataResponse);
with
System.Web.Script.Serialization.JavaScriptSerializer serial = new System.Web.Script.Serialization.JavaScriptSerializer();
JSONElements incoming = serial.Deserialize<JSONElements>(dataResponse);
Upvotes: 1
Reputation: 21
I think is to library is not registered with GAC and when is execute SSIS makes copy and run from TEMP. From there calls external libraries and looks in Registered places "Path" in System Variables. Try to modify it but cannot restart machine - its server without Microsoft SDK. So don't see any more solution for that
Upvotes: 0