Friday 15 February 2013

Running a long COM operation in C#, unable to remove poison message -



Running a long COM operation in C#, unable to remove poison message -

i've been working on week , used stackoverflow extensively, can't figure out.

i'm writing plug-in in c# in autodesk product, , i'm connected (with marshal) different 3d application. i've done dozens of other plug-ins in past without issue.

this project unique. different 3d application, i'm running long-running task (file export) on big model. takes 1-60 minutes @ times.

i toxicant message: "this action cannot completed because 'application' not responding. take "switch to" and..." technically, can allow client click "retry" until finds application, undesirable.

i thought set doevents type thing, , wait export finish, toxicant message appears while export sub running (this first occurrence toxicant messages, i'm learning). looked running export operation on background thread, testing threadpool , thread operations. however, can "start" service, never exports model different 3d application. runs forever. (i removed error message original post because i'm not looking solution sub-problem, rather i'm describe below)

lastly, tried modify netmsmqbinding (i know nil either, trying larn it) in hopes set number of allowed retries bigger number.

system.timespan ts = new system.timespan(0, 30, 10); system.timespan tb = new system.timespan(10, 0, 0); netmsmqbinding nmb = new netmsmqbinding(); nmb.maxretrycycles = 1000; nmb.receiveretrycount = 1000; nmb.retrycycledelay = ts; nmb.opentimeout = tb;

however, no matter alter netmsmqbinding values to, "retry" message @ same time. must not writing correctly. in other examples, noticed xml file containing these values, , don't know xml is. nor want know, because i'd rather have run in plug-in, rather have xml file deal with.

i'm finding lots of examples on how deal in hypothetical (lots of console.write bs), nil has concrete illustration long running com process interrupting main c# utility.

i'd figure out how reset retry frequency , cycles lastly longer, toxicant messages aren't presented. how can that?

here more code, give context:

namespace testing_v0 { [pluginattribute("testing_v0r1", "adsk", tooltip = "testing plugin", displayname = "testing plugin")] [addinpluginattribute(addinlocation.addin)] public class myplugin : addinplugin { public override int execute(params string[] parameters) { system.timespan ts = new system.timespan(0, 30, 10); system.timespan tb = new system.timespan(10, 0, 0); netmsmqbinding nmb = new netmsmqbinding(); nmb.maxretrycycles = 1000; nmb.receiveretrycount = 1000; nmb.retrycycledelay = ts; nmb.opentimeout = tb; //nmb.receiveerrorhandling = receiveerrorhandling.drop; //do export process here } } }

because didn't have anymore time work on this, explain how resolved this. not advisable way resolve issue, has advantages.

on non-related project few months ago, did similar application exported same file format, console application. there no issues console application these issues arising in dll autodesk product.

using remembered console app export, made new little console app exe did file export. used system.io.process.start(file.exe, "arguments") command in parent dll trigger executable.

this roundabout way rid of pop messages, there advantages. executable runs export, while c# dll continues. allows me run simple file-exists loop until file appears in directory, continues on. set progress counter in c# dll ui, , gives client nice stable read out while exporter running.

like said, not ideal, works me, now.

c# com marshalling netmsmqbinding

No comments:

Post a Comment