Code Red > .NET

Calling a function from WPF form causes System.ArgumentException

<< < (2/2)

nobody:

--- Quote from: Jeff_M on July 22, 2019, 01:39:13 PM ---Of course I discover the solution almost as soon as I post this. Once I added the following it works as it should.


--- Code - C#: ---            using (DocumentLock dl = doc.LockDocument())            {                 ...the code to create the profile here             } 
--- End quote ---

bahahaha.... SOOOOOO glad I'm not the only one that happens to!

CADbloke:
I just added that to a long-running project. :/ Long running ... it was git commit # 1.343. Exception handling kept it alive. I'm glad I log all exceptions

You are not alone.

gile:
Hi,

Document.DocumentLock() returns a DocumentLock instance which only provides a Dispose() method.
So, when called within a using statement, storing the return value of DocumentLock() in a variable seems to me absolutely useless.
By my side, I use:

--- Code - C#: ---using (doc.LockDocument()){    ...the code here}

Navigation

[0] Message Index

[*] Previous page

Go to full version