Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LoadFromString NullReferenceException (Read 2505 times)
Alex
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 60
Joined: Nov 21st, 2006
LoadFromString NullReferenceException
Oct 19th, 2007 at 8:52am
Print Post  
Hello,

I encounter the following problem:

I save a diagram with the SaveToString() method as a XML string.

The I try to load the XML string again with the LoadFromString method, but I always get a NullreferenceException within the call of LoadFromString.

Any ideas?

Best regards,

Alex
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LoadFromString NullReferenceException
Reply #1 - Oct 19th, 2007 at 9:04am
Print Post  
Hello,

Could you set a breakpoint at the LoadFromString line and see if the string argument is not null be some chance?

Where are you storing the result returned from SaveToString()? LoadFromString might fail if the XML special symbols have been replaced with some escape sequences, e.g. if you are escaping them when saving the string somewhere, but not un-escaping them when loading?

Stoyan
  
Back to top
 
IP Logged
 
Alex
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 60
Joined: Nov 21st, 2006
Re: LoadFromString NullReferenceException
Reply #2 - Oct 19th, 2007 at 9:15am
Print Post  
The string is not empty and it is stored in an object oriented database, db4o as String. This should not alter the String at all.

I changed it to SaveToString() without any parameters and it works correctly so far.

I keep trying, maybe I can narrow it down to some point.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LoadFromString NullReferenceException
Reply #3 - Oct 19th, 2007 at 9:28am
Print Post  
What happens if you run the following?

diagram.LoadFromString(diagram.SaveToString(StringFormat.XML))
  
Back to top
 
IP Logged
 
Alex
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 60
Joined: Nov 21st, 2006
Re: LoadFromString NullReferenceException
Reply #4 - Oct 19th, 2007 at 9:37am
Print Post  
I try that later. Keep you posted!
  
Back to top
 
IP Logged
 
Alex
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 60
Joined: Nov 21st, 2006
Re: LoadFromString NullReferenceException
Reply #5 - Oct 20th, 2007 at 7:19am
Print Post  
Ok, one thing I found out:

If I set the cleardirty flag to true, the LoadFromString method has a null reference. If I set the flag to false, I can load the diagram from the generated XML string.

But not all of the diagram properties are read from the string I think, because there is still a major difference between the behavior if I load the diagram from an normal string than from the XMl string.

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LoadFromString NullReferenceException
Reply #6 - Oct 20th, 2007 at 9:06am
Print Post  
Are you handling the DirtyChanged event, and perhaps doing some changes to the diagram from the handler? Could you send the strings generated with and without using clearDirty to our support email address?

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