After upgrading Aspose.Diagram to the version 25.6.0, I encounter an exception when I save visio document as HTML. In my previous aspose version (25.3.0) this error didn’t exist.
Here is a sample project to reproduce the issue: aspose-test-app.zip (366.1 KB)
Steps to reproduce:
Open project in Visual Studio and run it
Choose a destination folder and press a button
You should get exception
An unhandled exception has occurred while executing the request.|System.OverflowException: Negating the minimum value of a twos complement number is invalid.
at ����.�(Int32 �, Int32 �)
at ����.�(��� �, ImageSaveOptions �, Boolean �)
at ����.�(��� �, ImageSaveOptions �)
at ����.�(String �, HTMLSaveOptions �, Diagram �, Shape �)
at Aspose.Diagram.Shape.ToHTML(String fileName, HTMLSaveOptions options)
The exception you’re encountering, System.OverflowException: Negating the minimum value of a twos complement number is invalid, typically occurs when there’s an issue with the data being processed, especially after an upgrade. This could be due to changes in how the library handles certain data types or structures in the newer version.
Solution
To resolve this issue, you can try the following steps:
Check for Updates: Ensure that you are using the latest version of Aspose.Diagram. Sometimes, bugs are fixed in subsequent releases.
Review Your Code: Look for any specific data or shapes in your Visio document that might be causing the overflow. This could be particularly relevant if you have shapes with extreme dimensions or properties.
Use HTMLSaveOptions: When saving to HTML, make sure to configure the HTMLSaveOptions properly. For instance, setting a default font can help if there are issues with rendering certain characters.
Test with Simplified Data: Create a minimal version of your Visio document to see if the issue persists. This can help identify if specific elements are causing the problem.
Code Example
Here’s a basic example of how to set up HTMLSaveOptions:
using Aspose.Diagram;
var diagram = new Diagram("yourfile.vsdx");
var options = new HTMLSaveOptions
{
DefaultFont = "Arial", // Set a default font
PageCount = 1, // Specify the number of pages to render
PageIndex = 0 // Specify the starting page index
};
diagram.Save("output.html", options);
Next Steps
If the issue persists after trying the above steps, reach out to Aspose support with a simplified version of your Visio document that reproduces the error. This will help in diagnosing the problem more effectively.
Please let me know if you need further assistance!
@mmdevelopment
Thanks for the project.
After an initial testing, I am able to reproduce the issue as you mentioned by using your template file.We will evaluate your issue further.
We apologize for any inconvenience caused.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): DIAGRAMNET-53782
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The issues you have found earlier (filed as DIAGRAMNET-53782) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou