Error when loading Visio file with version below 11

I have a script that exports Visio files to PDF files. This is automatically executed by another script.
When it tries to load an old Visio file I get an error saying, that versions below 11 are not supported.
Is there any way to check the version of the file before this error occurs? As the script is supposed to run in the background I dont want the user to get an error message. The file should just be skipped.

Here is my script:

Imports Aspose.Diagram
Imports System.IO
Module Module1
	Sub Main()
		Dim sInputFile, sOutputFile As String
		Try
			Dim sParams() As String = Environment.GetCommandLineArgs

			If sParams.Length <> 3 Then
				MsgBox("Parameterliste nicht richtig... Abbruch!")
				Exit Sub
			Else
				sInputFile = Replace(sParams(1), "|", " ")
				sOutputFile = sParams(2).Replace("|", " ")
			End If

			Dim Type
			Dim File As IO.FileSystemInfo
			File = New FileInfo(sInputFile)
			Type = File.Extension
			Dim oVSD As New Diagram(sInputFile)
			If oVSD.Version >= "11" Then
				If Type = ".vsdx" Or Type = ".vsd" Then
					oVSD.Save(sOutputFile, SaveFileFormat.PDF)
				Else
					MsgBox("Dies ist keine gültige Visio-Datei.")
					Exit Sub
				End If
			Else
				Exit Sub
			End If
		Catch ex As Exception
			MsgBox(ex.Message & vbLf & ex.StackTrace)
		End Try
	End Sub
End Module

@ThomasWestbeld

Thank you for contacting support.

Would you please share a sample file which reproduces this error so that we may try to reproduce and investigate it in our environment.

Projekt1.zip (96.6 KB)

Here is a sample file.

When I run the script with this file I get an error message as soon as the command
Dim oVSD As New Diagram(sInputFile)
is executed.

@ThomasWestbeld

Thank you for sharing requested data.

Aspose.Diagram for .NET API includes Version property exposed by Diagram class, which can be used to determine Version number of Visio instance. However, attached file is not correctly loaded by the API and the exception is thrown. So, any property of Aspose.Diagram API can not be utilized and a possible approach to avoid crashing of your application is Exception Handling, as in the lines of code below:

    Try
        Dim oVSD As New Diagram("D:\Projekt1.vsd")
    Catch exception As Exception
        If (exception.Message.Contains("Visio files with versions below 11 are not supported.")) Then
            Console.WriteLine("Exception Detected!")
            'TODO Code Here
        End If
    End Try

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

Thanks for your help.