I am using the XamRichTextEditor, HtmlSerializationProvider, and WPF main from v15.1
A InvalidOperationException is thrown when trying to access the nullable RenderSizeResolved property of an ImageNode. This exception is only encountered if an image is the first piece of content on the document, and the document was saved/loaded with the HtmlSerializationProvider.
The error is not encountered with the WordSerializationProvider.
To reproduce this exception, do the following:
1. Open sample app
2. Click 'Insert Image' and select an image
3. Click 'Save' and close the editor
4. Open the sample app again, and click 'Load'
* Note the exception that is thrown when trying to access the RenderSizeResolved property.
I will attach the sample app
Hello Ben,
You can avoid this null exception by adding a check whether or not the image has a render size value along with your null check:
if (image != null && image.RenderSize.HasValue == true)
Hey Michael,
Thanks for the reply. We are using the size property to set a field on an image transform ribbon tab. The ribbon tab item is only shown if an image is 'selected'. When a document is loaded, we place the selection at the beginning so a document with an image as the first item would have that image selected.
I can do the HasValue check to get past this issue. The only reason I reported it was that the WordSerializationProvider does not give us this issue and the property has a value on our first pass. I was just curious what the inconsistency was.
-Ben
I have created a private support case for you with ID CAS-168831-B1W7J0. You could reach your case following the link bellow:
https://www.infragistics.com/my-account/support-activity I will update you via the mentioned case, so if you have any further questions or comments please update your case.
This behavior was determined not to be an issue in our source code, but in your application. We determined that your sample project was attempting to get the RenderSizeResolved at a point when the document had not completed loading, and at that time the RenderSizeResolved property is not yet valid.
You can hook Application's Idle event and perform the load. Please review it and let me know if you have any questions.
I appreciate the response. I will factor this in when we come back to Image Transforms and test it out.