I'm trying to use a DifferenceCursor on a utility network feature service geodatabase.
I am following the guide here
I am able to use the VersionManager class to open the default geodatabase and the version geodatabase and then open the same feature class from both of them. However, when I try to create a DifferenceCursor I get this error
"Object has no schema locks".
I dug into this a bit further via the VersionManagerServer rest endpoints.
If you go to https://<server_url>/rest/services/<feature_server>/VersionManagementServer/versions/<version_guid>/differences
and try to run it you get the same error:

This can be overcome by running the startReading command

Then you can go back to the differences endpoint, put the same sessionId in and it works.
It doesn't look like VersionManager does this first step of starting a read session.
Here's a snippet of the code I'm using.
ServiceConnectionProperties serviceConnectionProperties <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ServiceConnectionProperties</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>config<SPAN class="punctuation token">.</SPAN>Connection<SPAN class="punctuation token">.</SPAN>UtilityServiceUri<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="punctuation token">(</SPAN>Geodatabase gdb <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Geodatabase</SPAN><SPAN class="punctuation token">(</SPAN>serviceConnectionProperties<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="punctuation token">(</SPAN>VersionManager versionManager <SPAN class="operator token">=</SPAN> gdb<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetVersionManager</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">//here's where I was going to try calling the startReading operation directly off the ReST endpoint</SPAN>
WebClient versionManagerClient <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">WebClient</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
BaseAddress <SPAN class="operator token">=</SPAN> config<SPAN class="punctuation token">.</SPAN>Connection<SPAN class="punctuation token">.</SPAN>UtilityServiceUri <SPAN class="operator token">+</SPAN> <SPAN class="string token">"/VersionManagementServer"</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
Version navigateVersion <SPAN class="operator token">=</SPAN> versionManager<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetVersions</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">First</SPAN><SPAN class="punctuation token">(</SPAN>v <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> v<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetName</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">==</SPAN> config<SPAN class="punctuation token">.</SPAN>ApplicationConfiguration<SPAN class="punctuation token">.</SPAN>NavigateVersion<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="punctuation token">(</SPAN>Geodatabase navigateGdb <SPAN class="operator token">=</SPAN> navigateVersion<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Connect</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">foreach</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">string</SPAN> featureClass <SPAN class="keyword token">in</SPAN> config<SPAN class="punctuation token">.</SPAN>FeatureClasses<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">//service feature classes have the layer number prefix i.e L0PipelineLine</SPAN>
<SPAN class="comment token">//so we use this function to translate between human readable and the actual layer name</SPAN>
FeatureClassDefinition serviceFCDefinition <SPAN class="operator token">=</SPAN> <SPAN class="token function">GetServiceFeatureClassName</SPAN><SPAN class="punctuation token">(</SPAN>featureClass<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">string</SPAN> serviceFeatureClassName <SPAN class="operator token">=</SPAN> serviceFCDefinition<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetName</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
FeatureClass defaultFc <SPAN class="operator token">=</SPAN> gdb<SPAN class="punctuation token">.</SPAN>OpenDataset<SPAN class="operator token"><</SPAN>FeatureClass<SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN>serviceFeatureClassName<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
FeatureClass navigateFc <SPAN class="operator token">=</SPAN> navigateGdb<SPAN class="punctuation token">.</SPAN>OpenDataset<SPAN class="operator token"><</SPAN>FeatureClass<SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN>serviceFeatureClassName<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//this line gives me "Object has no schema locks"</SPAN>
DifferenceCursor diffCursor <SPAN class="operator token">=</SPAN> navigateFc<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Differences</SPAN><SPAN class="punctuation token">(</SPAN>defaultFc<SPAN class="punctuation token">,</SPAN> DifferenceType<SPAN class="punctuation token">.</SPAN>Insert<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">while</SPAN> <SPAN class="punctuation token">(</SPAN>diffCursor<SPAN class="punctuation token">.</SPAN><SPAN class="token function">MoveNext</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">using</SPAN> <SPAN class="punctuation token">(</SPAN>Row row <SPAN class="operator token">=</SPAN> diffCursor<SPAN class="punctuation token">.</SPAN>Current<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
log<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Append</SPAN><SPAN class="punctuation token">(</SPAN>String<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Format</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Post Change: insert into geometry_changes ({0}) values()"</SPAN><SPAN class="punctuation token">,</SPAN>
String<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Join</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">", "</SPAN><SPAN class="punctuation token">,</SPAN> outputFields<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>