Custom script runtime error

All,

We have a requirement to connect to cosmos DB to push user data. we decided to user gremlin.net libraries for same.

I was able to import dependent libraries build in Visual studio.

My script looks like below.

#If Not SCRIPTDEBUGGER Then
References netstandard.dll
References Gremlin.Net.dll
References Newtonsoft.Json.dll
References System.Runtime.dll
Imports System.Runtime
Imports System.Collections.Generic
Imports System.Net.WebSockets
Imports System.Threading.Tasks
Imports Gremlin.Net.Driver
Imports Gremlin.Net.Driver.Exceptions
Imports Gremlin.Net.Structure.IO.GraphSON
Imports Newtonsoft.Json
#End If
Function Odd() As TimeSpan
Return TimeSpan.FromSeconds(10)
End Function
Public Function CCC_CosmosDB_Gremlin() As Boolean
Dim EndpointUri As String = "XXXXX"
' The primary key For the Azure Cosmos account.
Dim PrimaryKey As String = "XXXXX"
Dim gremlinServer = New GremlinServer("XXX.gremlin.XXX.azure.com", 443, True, "XXXX",PrimaryKey)
Dim connectionPoolSettings As ConnectionPoolSettings = New ConnectionPoolSettings() With {
.MaxInProcessPerConnection = 10,
.PoolSize = 30,
.ReconnectionAttempts = 3,
.ReconnectionBaseDelay = TimeSpan.FromMilliseconds(500)
}

'Dim webSocketConfiguration = New Action(Of ClientWebSocketOptions)(AddressOf Odd)

'Dim gremlinClient1 = New GremlinClient(gremlinServer, New GraphSON2Reader(), New GraphSON2Writer(), GremlinClient.GraphSON2MimeType, connectionPoolSettings, webSocketConfiguration)
Dim gremlinClient = New GremlinClient(gremlinServer, New GraphSON3Reader(), New GraphSON3Writer())
Dim Query = "g.addV('person').property('id', '9876456').property('givenName', 'Thomas').property('guid', 44).property('pk', 'pk')"
VID_Write2log("D:\logs\cosmos_Gremlin.txt", "Query " & Query)
Dim response = gremlinClient.SubmitAsync(Query)
response.wait()
VID_Write2log("D:\logs\cosmos_Gremlin.txt", "Cosmos " & response.ToString())
End Function

When i am trying to test this script , i am seeing below.

Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Full Error:

Exception has been thrown by the target of an invocation.
at Designer.ScriptEditor.ScriptTestEditor.ExecuteScript(ScriptItem sItem)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Gremlin.Net.Driver.GremlinClientExtensions.<SubmitAsync>d__2.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
--- End of stack trace from previous location where exception was thrown ---
at Gremlin.Net.Driver.GremlinClientExtensions.<SubmitAsync>d__4`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
--- End of stack trace from previous location where exception was thrown ---
at Gremlin.Net.Driver.GremlinClient.<SubmitAsync>d__7`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
--- End of stack trace from previous location where exception was thrown ---
at Gremlin.Net.Driver.ProxyConnection.<SubmitAsync>d__6`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
--- End of stack trace from previous location where exception was thrown ---
at Gremlin.Net.Driver.Connection.<SendMessagesFromQueueAsync>d__27.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
--- End of stack trace from previous location where exception was thrown ---
at Gremlin.Net.Driver.Connection.<SendMessageAsync>d__31.MoveNext()
at Gremlin.Net.Structure.IO.GraphSON.GraphSONMessageSerializer.SerializeMessageAsync(RequestMessage requestMessage)
at Gremlin.Net.Structure.IO.GraphSON.GraphSONWriter.WriteObject(Object objectData)

I have .cs version of same code, which runs fine in Visual studio with same libraries.

I am not able to find system.runtime.dll version 4.2.1.0 it is not available in nuget package manager.

How do i resolve this.

Parents Reply Children
  • First I would create a backup of your "<OneIM InstallationDir>\Modules\QBM\install\bin\SystemLibrary\Scripts\CustomScripts.vb file. Do have a backup of all scripts, that you haven't uploaded to the database. Just in case.

    Then, copy the folder "<OneIM Delivery>\Modules\QBM\install\bin\SystemLibrary" into your installation directory.