We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Vsdm file is corrupted upon save

I’ve just tried to save a particular file and am getting an unhandled exception (see below).

I can give more details and post the Visio file if this is helpful. I have a 2nd test file which does save correctly. I’m using a temporary license.
The file will not open in Visio afterwards and I get a message saying the file is corrupt. This would be a serious issue if it occurred in a production environment.

Any assistance would be appreciated.

was unhandled
Message=Could not read block - no data! (position 0x0001B8CF)
at . (Stream , String )
at . ( )
at . (Stream , TextWriter , Encoding , EventHandler )
at …ctor(Stream )
at . (Stream )
at . (Stream )
at Aspose.Diagram.Vba.VbaProject. (String )
at Aspose.Diagram.Vba.VbaProject. ( )
at . ()
at . ()
at .Save()
at . (Stream , SaveFileFormat )
at Aspose.Diagram.Diagram.Save(Stream stream, SaveOptions options)
at Aspose.Diagram.Diagram.Save(String filename, SaveFileFormat format)
at AsposeDiagram.Form1.Button1_Click(Object sender, EventArgs e) in N:\Product Development\Andrew Ridgeley\Temporary Projects\AsposeDiagram\AsposeDiagram\Form1.vb:line 16
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at AsposeDiagram.My.MyApplication.Main(String[] Args) in :line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Hi Andrew,

Thank you for contacting support. Please provide us your complete details of the use case, including source Visio drawing and code. It’ll help us to replicate the problem on our side. We’ll investigate and reply you appropriately. Your response is awaited.

Hi Imran

I’ve added the source code below and have attached the Visio file. Please let me know if you need any further information.


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnExport.Click

Dim license As New Aspose.Diagram.License
license.SetLicense(“C:\temp\Aspose Diagram Test\Aspose.Diagram.lic”)

Dim map As New Aspose.Diagram.Diagram(txtVisioFile.Text)

map.Save(txtVisioFile.Text, Aspose.Diagram.SaveFileFormat.VSDM)

End Sub

Just to follow up on this, I’ve now found that removing the macro will stop the error from happening.

Hi Andrew,

Thank you for contacting support. We managed to replicate the said error on our side. It has been logged under ticket ID DIAGRAMNET-51159 in our bug tracking system. Your post has also been linked to this ticket. We shall keep you informed regarding any available updates. We are sorry for the inconvenience caused.

Besides, we removed Macros from the source VSDM drawing, but it still shows an error. Please share the exact steps to modify the source VSDM drawing, which help to avoid this error. This will help us to rectify the root cause. Your response is awaited.

Hi Imran

I’ve added some code below to show how the error is being produced.

To produce the error, run the 2 lines below with the sample map

Dim map As New Aspose.Diagram.Diagram(txtVisioFile.Text)
map.Save(txtVisioFile.Text, Aspose.Diagram.SaveFileFormat.VSDM)

If the macro is removed before saving (as shown in code below), the file saves correctly.

Dim map As New Aspose.Diagram.Diagram(txtVisioFile.Text)
map.Save(txtVisioFile.Text, Aspose.Diagram.SaveFileFormat.VSDM)

Hi Andrew,

Thank you for the details. We have added this information in our bug tracking system against the ticket ID DIAGRAMNET-51159. Indeed, this will help us in investigations.

Hi Imran

Thanks for the update. Do you have any idea when this bug might be fixed? We’re currently evaluating your product; so far it has met our needs well and we’d like to move ahead with a purchase. However, this issue could cause us some significant problems if we have to remove macros for all vsdm files before making changes.


Hi Andrew,

Thank you for the inquiry. Our product team has resolved the ticket ID DIAGRAMNET-51159. If there is no issue in the QA phase, then this fix will be included in the next version 17.03.0 of Aspose.Diagram for .NET API. It is expected in a couple of weeks. We’ll inform you via this forum thread as soon as the new release is published.

Hi Imran

Many thanks for the prompt action on this. Knowing that issues are being addressed gives us confidence in the product and we’ll almost certainly be moving ahead with a purchase.

I’ll look forward to hearing from you when the release is available.


Hi Andrew,

Thank you for the kind feedback. You will receive an automated email notification once the new version 17.3.0 of Aspose.Diagram for .NET is published.

The issues you have found earlier (filed as DIAGRAMNET-51159) have been fixed in Aspose.Diagram for .NET 17.3.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.