Question

1
Replies
293
Views
RobIsTheName Member since 2017 31 posts
RBC
Posted: 3 years ago
Last activity: 3 years 1 month ago
Closed

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:

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);

            }

        }
    }
}
Robotic Process Automation
Moderation Team has archived post
Share this page LinkedIn