Select to view content in your preferred language

What is wrong with this code: pWorkspace.FindVersion

246
1
01-16-2019 04:26 PM
JoseSanchez
Frequent Contributor

Reposted under ArcObjects group.

pWorkspace = pWorkspaceFactory.OpenFromFile(prefixOutput, 0)

Dim version As IVersion = CType(pWorkspace, IVersion)

Dim versionName As String = version.VersionName

Dim targetVersion As IVersion = Nothing 

 

' check if working with Editor's version

 

If version.VersionName <> strEditorVersion Then

   targetVersion = CType(pWorkspace.FindVersion(strEditorVersion ), IVersion)   ************  It crashes here

End If

 

 

ERROR MESSAGE

Error Message: Object reference not set to an instance of an object.Date1/16/2019

0 Kudos
1 Reply
JoseSanchez
Frequent Contributor

I also tried this code and it also fails:

dim version As IVersion = CType(pWorkspace, IVersion)

                Dim versionName As String = version.VersionName

                Dim targetVersion As IVersion = Nothing

 

 

                Console.WriteLine("versionName: " & versionName)

                '

                ' working with Editor's version

                '

                If version.VersionName <> strAEditingVersion Then

 

                    Dim VrsWrkSpc = CType(pWorkspace, IVersionedWorkspace3)     FAILS HERE!!!!!!!!!!!

 

                    targetVersion = VrsWrkSpc.FindVersion(strEditingVersion)

 

                End If

 

0 Kudos