Question
RBC
CA
Last activity: 7 Sep 2017 22:28 EDT
Call Automation from C#.. Stuck with error: Exception thrown: 'System.NullReferenceException' in OpenSpan.Runtime.Core.dll Object reference not set to an instance of an object.
Hi,
I've been trying to experiment with calling an automation from C#, but am experiencing an nullReference error on creating new instance of the automation reference.. I used two articles to base my code on (https://pdn.pega.com/example-using-studio-adapters-c-project & https://pdn.pega.com/documents/creating-csharp-studio-project-references) Both suggest I can easily make the call, but I get a failure on the cca = new CcallingActivity.Project.CcallingActivity(); line of code. I've included all the pega references I could find, and the project compiles without error. Must be missing something.. But figure out what/where to look? this is Pega Robotics v8.0 with .net 4.6.1
The code I'm using is below:
Hi,
I've been trying to experiment with calling an automation from C#, but am experiencing an nullReference error on creating new instance of the automation reference.. I used two articles to base my code on (https://pdn.pega.com/example-using-studio-adapters-c-project & https://pdn.pega.com/documents/creating-csharp-studio-project-references) Both suggest I can easily make the call, but I get a failure on the cca = new CcallingActivity.Project.CcallingActivity(); line of code. I've included all the pega references I could find, and the project compiles without error. Must be missing something.. But figure out what/where to look? this is Pega Robotics v8.0 with .net 4.6.1
The code I'm using is below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using OpenSpan.Diagnostics;
namespace caCaller
{
class Program
{
public static CcallingActivity.Project.CcallingActivity cca;
public static CcallingActivity.simpleAdd sa;
static void Main(string[] args)
{
try
{
Diagnostic.Initialize();
Diagnostic.TraceError("Starting");
cca = new CcallingActivity.Project.CcallingActivity();
cca.Start();
}
catch (Exception err)
{
Debug.WriteLine(err.Message);
}
}
}
}