Code Red > .NET

About Document.SendStringToExecute()

(1/2) > >>

CrockettScience:
I'm working with a command in C# where we initialize a pack of documents based on certain criteria. It involves a queue of documents being created, edited, and saved. The way we do this is we create the Doc, switch to it, then SendStringToExecute() with a hidden command that does the initializing, saves it to file, then checks the queue to see if there's more and repeats. This way, each document is edited in it's own document context, which we need to do for reasons I can't get into.

It works most of the time, but quite commonly, it crashes at random in such a way that isn't reproducible. After some testing, the problem seems to go away when the second boolean argument of SendStringToExecute(), that is, wrapUpInactiveDoc, is set to true. However, the only problem there is then SendStringToExecute() throws an eInvalidInput error every time it's called, and then crashes when all the commands are complete. The documents end up otherwise unscathed, It's just inconvenient and bad presentation for our clients.

So I want to know, what exactly does wrapUpInactiveDoc = true actually do, why does it throw an eInvalidInput exception, and how can I do this in a way that doesn't throw that error.

dgorsman:
Backing up a step... how many drawings are we talking about?  Dozens?  Hundreds?

CrockettScience:
At most, it could possibly be 1 or 2 dozens. Or only a handful. It really depends on the project.

But let's assume worst case scenario for the sake of stability. Is it possible to have too many?

CrockettScience:
Hmm, it seems as though the problem is unchanged even when I close each document after I'm done with it.

kdub_nz:
Is the Save done in your code or by code dependant on the SendString ?
I s'pose my real question is how complex is the command you are passing ?

I recall reading 'somewhere' recommendations about the use of wrapUpInactiveDoc, but sorry, age is affecting my memory.

added afterthought :
Are you doing the Save inside a transaction Scope ?

Navigation

[0] Message Index

[#] Next page

Go to full version