Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic MindFusion.Diagramming.Diagram.LoadFromStream Exceptions list (Read 3675 times)
david pires
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Feb 9th, 2016
MindFusion.Diagramming.Diagram.LoadFromStream Exceptions list
Feb 9th, 2016 at 2:58pm
Print Post  
Hi I'm using Diagram.LoadFromStream and it's currently inside a try-catch block and I'm adding some error handling to it and so I'm trying to find a list of possible/expected exceptions thrown by this method but in the documentation only states:

"...The method throws exception if the stream given as argument does not contain data of the proper format."

No specific exception is defined, any chance you could provide me a list of exceptions that this method throws?

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: MindFusion.Diagramming.Diagram.LoadFromStream Exceptions list
Reply #1 - Feb 9th, 2016 at 5:18pm
Print Post  
Hi,

The only exception thrown directly by our code is FileLoadException. LoadFromStream calls BinaryFormatter and BinaryReader methods that could throw these exceptions according to their msdn topics -

EndOfStreamException The end of the stream is reached.
ObjectDisposedException The stream is closed.
IOException An I/O error occurs.

ArgumentNullException The serializationStream is null reference (Nothing in Visual Basic).
SerializationException The serializationStream supports seeking, but its length is 0.
SecurityException The caller does not have the required permission.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
david pires
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Feb 9th, 2016
Re: MindFusion.Diagramming.Diagram.LoadFromStream Exceptions list
Reply #2 - Feb 10th, 2016 at 10:50am
Print Post  
Thanks for the reply Slavcho,

...and I should have expected it as we are also using the SaveToStream and I found the same issue in our code where no proper error handling is being done, could you give the exceptions for the SaveToStream method?

thanks in advance.

David
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: MindFusion.Diagramming.Diagram.LoadFromStream Exceptions list
Reply #3 - Feb 10th, 2016 at 11:03am
Print Post  
Hi David,

SaveToStream throws InvalidOperationException if your diagram contains instances of custom classes that are not registered for serialization using RegisterItemClass method. Called BinaryWriter and BinaryFormatter methods could throw following exceptions -

IOException An I/O error occurs.
ObjectDisposedException The stream is closed.

ArgumentNullException The serializationStream is null reference (Nothing in Visual Basic).

-or-

The graph is null.

SerializationException An error has occurred during serialization, such as if an object in the graph parameter is not marked as serializable.

SecurityException The caller does not have the required permission.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
david pires
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Feb 9th, 2016
Re: MindFusion.Diagramming.Diagram.LoadFromStream Exceptions list
Reply #4 - Feb 10th, 2016 at 11:16am
Print Post  
Thanks Slavko,

Sorry for nagging you twice as I could've done it in one if I had gone to the hole process of saving and retrieving.
All good for me.

Best regards,

David
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint