0

I am trying to post a WorkItem using v2 of the Design Automation API and forge-api-nodejs-client. The WorkItem takes a json file as an input parameter. The custom .NET plugin that I've created, depends on the json file.

The WorkItem fails due to FailedMissingOutput. I printed out the report and noticed this...

[02/11/2019 19:14:48] Command: DRAWMARKUPS
[02/11/2019 19:14:49] ************************MessageBox****************************
[02/11/2019 19:14:49] AutoCAD Error Aborting
[02/11/2019 19:14:49] FATAL ERROR:  Unhandled Access Violation Reading 0x0008 Exception at 82480c14h
[02/11/2019 19:14:49] >>>Responding: OK.
[02/11/2019 19:14:49] **************************************************************
[02/11/2019 19:14:49] ************************MessageBox****************************
[02/11/2019 19:14:49] AutoCAD Error-abort
[02/11/2019 19:14:49] Error handler re-entered.  Exiting now.
[02/11/2019 19:14:49] >>>Responding: OK.
[02/11/2019 19:14:49] **************************************************************
[02/11/2019 19:14:49] End AutoCAD Core Engine standard output dump.
[02/11/2019 19:14:50] Error: AutoCAD Core Console output contains error(s).
[02/11/2019 19:14:50] End script phase.
[02/11/2019 19:14:50] Start upload phase.
[02/11/2019 19:14:50] Error: Non-optional output [a57863c8-3085-4bc2-90b6-709595f1c566.dwg.dwg] is missing .
[02/11/2019 19:14:50] Error: An unexpected error happened during phase Publishing of job.
[02/11/2019 19:14:50] Job finished with result FailedMissingOutput

Here are the lines in my .NET plugin that might be breaking it...

string drawingName = Path.GetFileName(acDoc.Name);

...

// Read input parameters from JSON file
JArray jArray = JArray.Parse(File.ReadAllText("markups.json"));

...

acCurDb.SaveAs(drawingName, DwgVersion.AC1027);

Also, I'm not including any CommandLineParameters in Instruction object in the definition of my Activity.

  const activityObject = {
    id: id,
    instruction: {
      CommandLineParameters: null,
      Script: `${script}`
    },
    appPackages: appPackages,
    requiredEngineVersion: `20.1`,
    parameters: {
      InputParameters: [{
        Name: `HostDwg`,
        LocalFileName: `$(HostDwg)`
      }],
      OutputParameters: [{
        Name: outPutFilename,
        LocalFileName: `${outPutFilename}.dwg`
      }]
    },
    allowedChildProcesses: [],
    version: 1,
    isPublic: true,
    theData: null,
    obj: null
  };

I suspect that I'm missing the right CommandLineParameters from my Activity Definition, but I have no idea what those should be be.

Why is my WorkItem failing? Is it the Activity, or the plugin? And, how can I fix this?

Update: I fixed the .dwg.dwg typo in the output filename. Now the WorkItem succeeds, but I still get the Unhandled Access Violation error. Also, my script doesn't seem to be reading in the json file. The plugin works locally, so I still don't know what's up.

1 Answers1

0

I recommend that you add more logging to your .net plugin so that you can triangulate the problem. You can use simple Console.WriteLine methods and they will appear in your report. You probably want to catch the exception and dump it out so that you know what failed.

Where does markup.json come from? Is that part of your AppPackage zip?

I don't think that CommandLineParameters play any role here. You can leave it empty for activities that use accoreconsole.exe. We will default it.

Albert Szilvasy
  • 461
  • 3
  • 5
  • Will do. That's really good to know. I uploaded markups.json as an object in my bucket and created a signed resource URL for it. That URL is what I'm supplying to the WorkItem definition. – Andrew McEwen Feb 11 '19 at 21:50
  • My logging methods are not appearing in the report. I'm using System.Console.WriteLine("blah blah"); – Andrew McEwen Feb 11 '19 at 22:10
  • It should work as long as you use WriteLine. Write may not work because your process may crash before the buffers are flushed. WriteLine flushes the buffers. – Albert Szilvasy Feb 12 '19 at 18:42
  • How did you read the JSON with the signed URL? `File.ReadAllText` certainly won't work. Does the signed URL work locally? – Bryan Huang Mar 05 '19 at 04:33