Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) PdfExporter - NullReferenceException (Read 5370 times)
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
PdfExporter - NullReferenceException
Oct 29th, 2007 at 9:14am
Print Post  
Code
Select All
	PdfExporter pdfExporter = new PdfExporter();
	pdfExporter.Export(diagram, path);
 


(path is not null and valid)
throws following NullReferenceException

Code
Select All
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei MindFusion.Pdf.PdfPath.x7352b4255a638e05()
   bei MindFusion.Pdf.PdfPath..ctor(GraphicsPath path, Brush brush, PdfPage page, Boolean CreatedDirectly)
   bei MindFusion.Pdf.PdfPath..ctor(GraphicsPath path, Brush brush, PdfPage page)
   bei MindFusion.Pdf.PdfPage.AddObject(GraphicsPath path, Brush brush)
   bei MindFusion.Pdf.PdfGraphics.FillPath(Brush brush, GraphicsPath path)
   bei MindFusion.Diagramming.ShapeNode.xc79d59e9288101bd(IGraphics x41347a961b838962, RectangleF xa6236fc5cd405c4e, Boolean x2f9dabff87b2168b, Brush xb45de92d01a0ec1f, Pen x9c79b5ad7b769b12, RenderOptions xdfde339da46db651)
   bei MindFusion.Diagramming.ShapeNode.DrawShadow(IGraphics graphics)
   bei MindFusion.Diagramming.Diagram.x826b585edd6a93e2(IGraphics x41347a961b838962, RectangleF xa6236fc5cd405c4e, Boolean x979174172ae18db3)
   bei MindFusion.Diagramming.Diagram.Draw(IGraphics graphics, RenderOptions options, RectangleF clipRect, Boolean noModifiedItems)
   bei MindFusion.Diagramming.Export.PdfExporter.Export(Diagram diagram, String filePath)
...
 



What's wrong?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PdfExporter - NullReferenceException
Reply #1 - Oct 29th, 2007 at 9:31am
Print Post  
There was a similar problem in version 5.0 because the Clone() method of one of the GDI Brush types used to return null. Version 5.0.1 does not call Clone(), so that should be fixed there. Check if the new version works better for you, and if it doesn't, please email us your diagram saved in a file.

Stoyan
  
Back to top
 
IP Logged
 
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
Re: PdfExporter - NullReferenceException
Reply #2 - Oct 30th, 2007 at 7:26am
Print Post  
This problem occurs with version 5.0.1.

How can I send you the diagram via XML file?

After calling
Code
Select All
diagram.SaveToXml(fileName);
 


I got a SerializationException caused by a non-serializable tag object although you can find in the documentation following sentence
Quote:
If a tag is not serializable it won't be saved by the Save* methods.


SerializationException:
Code
Select All
Der Typ ... ist nicht als serialisierbar gekennzeichnet.
   bei System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
   bei System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
   bei System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
   bei System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
   bei System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
   bei System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
   bei System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
   bei System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
   bei MindFusion.Diagramming.XmlPersistContext.WriteObject(Object objectValue, String elementName, XmlElement parentElement)
   bei MindFusion.Diagramming.XmlPersistContext.WriteTag(Object item, Object tagValue, String elementName, XmlElement parentElement)
   bei MindFusion.Diagramming.DiagramItem.SaveToXml(XmlElement xmlElement, XmlPersistContext context)
   bei MindFusion.Diagramming.DiagramNode.SaveToXml(XmlElement xmlElement, XmlPersistContext context)
   bei MindFusion.Diagramming.ShapeNode.SaveToXml(XmlElement xmlElement, XmlPersistContext context)
   bei MindFusion.Diagramming.XmlPersistContext.xcfee0917c3bf82cc(DiagramItem xccb63ca5f63dc470, XmlElement x1ea18269223b2a9c, String x121383aa64985888)
   bei MindFusion.Diagramming.Diagram.SaveToXml(XmlDocument document)
   bei MindFusion.Diagramming.Diagram.SaveToXml(String fileName)
 

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PdfExporter - NullReferenceException
Reply #3 - Oct 30th, 2007 at 7:34am
Print Post  
Handle the SerializeTag event, and just set e.Handled = true.

Stoyan
  
Back to top
 
IP Logged
 
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
Re: PdfExporter - NullReferenceException
Reply #4 - Oct 30th, 2007 at 1:25pm
Print Post  
Thank you. Email has been sent...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PdfExporter - NullReferenceException
Reply #5 - Oct 30th, 2007 at 6:36pm
Print Post  
We have found one bug when testing with your diagram - the symbols with umlauts mess up badly the PdfExporter output, and Acrobat Reader cannot open the PDF file at all. The PDF was exported fine when we removed the umlauts -
http://www.mindfusion.org/_samples/test.pdf

However, this seems unrelated to the PdfPath exception that you are getting, which we cannot reproduce. Are you perhaps handling any custom-draw events? If so, could you send us your code?

Thank you,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PdfExporter - NullReferenceException
Reply #6 - Nov 5th, 2007 at 8:40am
Print Post  
Hi,

What regional settings are you using on your system?

Thank you,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PdfExporter - NullReferenceException
Reply #7 - Nov 8th, 2007 at 7:43am
Print Post  
We have fixed a couple of bugs in the PdfGraphics implementation:

- if a decimal symbol different from "." was selected in Control Panel / Regional Settings, this produced invalid PDF output
- umlauted or accented characters produced invalid PDF output

If anyone is interested in using the PdfExporter on non-English systems or with Unicode text, please try this version and let us know if you get any problems:
https://mindfusion.org/_beta/fcnet502.zip

Thank you,
Stoyan
  
Back to top
 
IP Logged
 
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
Re: PdfExporter - NullReferenceException
Reply #8 - Nov 13th, 2007 at 9:05am
Print Post  
Hi,

I replaced all libraries with your provided fix but following exception still occurs
Code
Select All
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei MindFusion.Pdf.PdfPath.x7352b4255a638e05()
   bei MindFusion.Pdf.PdfPath..ctor(GraphicsPath path, Brush brush, PdfPage page, Boolean CreatedDirectly)
   bei MindFusion.Pdf.PdfPath..ctor(GraphicsPath path, Brush brush, PdfPage page)
   bei MindFusion.Pdf.PdfPage.AddObject(GraphicsPath path, Brush brush)
   bei MindFusion.Pdf.PdfGraphics.FillPath(Brush brush, GraphicsPath path)
   bei MindFusion.Diagramming.ShapeNode.xc79d59e9288101bd(IGraphics x41347a961b838962, RectangleF xa6236fc5cd405c4e, Boolean x2f9dabff87b2168b, Brush xb45de92d01a0ec1f, Pen x9c79b5ad7b769b12, RenderOptions xdfde339da46db651)
   bei MindFusion.Diagramming.ShapeNode.DrawShadow(IGraphics graphics)
   bei MindFusion.Diagramming.Diagram.x826b585edd6a93e2(IGraphics x41347a961b838962, RectangleF xa6236fc5cd405c4e, Boolean x979174172ae18db3)
   bei MindFusion.Diagramming.Diagram.Draw(IGraphics graphics, RenderOptions options, RectangleF clipRect, Boolean noModifiedItems)
   bei MindFusion.Diagramming.Export.PdfExporter.Export(Diagram diagram, String filePath)
 



Is it possible that an invalid tagged object (Property Tag) can cause this problem?

Btw: My regional settings are "Deutsch(Österreich)" (German - Austria).
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PdfExporter - NullReferenceException
Reply #9 - Nov 13th, 2007 at 9:22am
Print Post  
Hi,

Could you also send us the Diagram and DiagramView related code from your form's InitializeComponent method?

Thank you,
Stoyan
  
Back to top
 
IP Logged
 
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
Re: PdfExporter - NullReferenceException
Reply #10 - Nov 23rd, 2007 at 12:10pm
Print Post  
Finally, after spending a lot of time analyzing this problem I found out that the pdf exporter struggles with color value
Code
Select All
Color.Transparent 


Especially a transparent shadow color (to turn off shadow) may cause crashes.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PdfExporter - NullReferenceException
Reply #11 - Dec 18th, 2007 at 1:21pm
Print Post  
Hi,

The Color.Transparent problem should be fixed in version 5.0.2. Please check if the beta version will work better for you:
https://mindfusion.org/_beta/FCNet.5.0.2.Beta.zip

Stoyan
  
Back to top
 
IP Logged
 
due
YaBB Newbies
*
Offline



Posts: 27
Joined: Jun 20th, 2007
Re: PdfExporter - NullReferenceException
Reply #12 - Dec 21st, 2007 at 9:51am
Print Post  
Now it works, thx!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint