VideoViewer2Playback as a COM component

With MIPS 23.3.1 we have got a working Component Applikation based on VideoViewer2Playback. It works fine as an exe File and works with System.Net.Http.Formatting, Version=5.2.7.0. (Which is installed with the MIP SDK)

Moving this to a com-component(dll) VideoOS.Platform.SDK.Environment.Login throws an error, it wants to use System.Net.Http.Formatting, Version=5.2.6.0.

Details:

System.IO.FileNotFoundException: Die Datei oder Assembly “System.Net.Http.Formatting, Version=5.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35” oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.

Dateiname: “System.Net.Http.Formatting, Version=5.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”

Additional Informations:

Server stack trace:

bei VideoOS.IdentityServer.Common.Handlers.TokenCache.d__21.MoveNext()

-– Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde —

bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

bei VideoOS.IdentityServer.Common.ServiceModel.BearerAuthorizationHeaderInspector.FormatToken()

bei VideoOS.IdentityServer.Common.ServiceModel.BearerAuthorizationHeaderInspector.BeforeSendRequest(Message& request, IClientChannel channel)

bei System.ServiceModel.Dispatcher.ImmutableClientRuntime.BeforeSendRequest(ProxyRpc& rpc)

bei System.ServiceModel.Channels.ServiceChannel.PrepareCall(ProxyOperationRuntime operation, Boolean oneway, ProxyRpc& rpc)

bei System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

bei System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

bei System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:

bei VideoOS.IdentityServer.Common.Handlers.TokenCache.d__21.MoveNext()

-– Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde —

bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

bei VideoOS.IdentityServer.Common.ServiceModel.BearerAuthorizationHeaderInspector.FormatToken()

bei VideoOS.IdentityServer.Common.ServiceModel.BearerAuthorizationHeaderInspector.BeforeSendRequest(Message& request, IClientChannel channel)

bei System.ServiceModel.Dispatcher.ImmutableClientRuntime.BeforeSendRequest(ProxyRpc& rpc)

bei System.ServiceModel.Channels.ServiceChannel.PrepareCall(ProxyOperationRuntime operation, Boolean oneway, ProxyRpc& rpc)

bei System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

bei System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

bei System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [1]:

bei System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

bei VideoOS.Common.Proxy.Server.WCF.Net.IServerCommandService.Login(Guid instanceId, String currentToken)

bei VideoOS.Platform.SDK.Config.Shared.LoginServerSvc.<>c__DisplayClass34_0.b__0(ServerCommandServiceClient client)

bei VideoOS.Platform.SDK.Config.Shared.LoginServerSvc.CallWithRetry[TResult](Func`2 call)

bei VideoOS.Platform.SDK.Config.Shared.LoginServerSvc.LoginService(Guid instanceGuid, String currentToken)

bei VideoOS.Platform.SDK.Config.LoginServerBase.Login(Uri uri)

bei VideoOS.Platform.SDK.Config.SystemInfo.Login()

bei VideoOS.Platform.SDK.Platform.SDKConfiguration.TryLogin(Uri uri, Boolean masterOnly)

bei VideoOS.Platform.SDK.Platform.SDKConfiguration.VideoOS.Platform.SDK.Platform.ISDKConfiguration.Login(Uri uri, Boolean masterOnly)

bei VideoOS.Platform.SDK.EnvironmentService.Login(Uri serverUri, Boolean masterOnly)

bei VideoOS.Platform.SDK.EnvironmentService.Login(Uri serverUri, Boolean masterOnly, Guid integrationId, String integrationName, String version, String manufacturerName)

bei VideoOS.Platform.SDK.Environment.Login(Uri serverUri, Guid integrationId, String integrationName, String version, String manufacturerName, Boolean masterOnly)

bei SdcSiveillanceLR_x64_ns.SdcSiveillanceLR.connectDevice(String sIp, String sUser, String sPass, String sEngine) in [D:\Projekte\Testprojekte\SdcSiveillanceLR\SdcSiveillanceLR.cs](file:D:/Projekte/Testprojekte/SdcSiveillanceLR/SdcSiveillanceLR.cs):Zeile 652.

=== Zustandsinformationen vor Bindung ===

LOG: DisplayName = System.Net.Http.Formatting, Version=5.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

(Fully-specified)

LOG: Appbase = file:///C:/Qt/Qt5.12.1/5.12.1/msvc2017_64/bin/

LOG: Ursprünglicher PrivatePath = NULL

Aufruf von Assembly : VideoOS.IdentityServer.Common, Version=23.3.0.0, Culture=neutral, PublicKeyToken=bc60fba4a7969f89.

===

LOG: Diese Bindung startet im LoadFrom-Load-Kontext.

WRN: Das native Image wird nicht im LoadFrom-Kontext durchsucht. Das native Image wird nur im Standard-Load-Kontext durchsucht, z. B. Assembly.Load().

LOG: Es wurde keine Anwendungskonfigurationsdatei gefunden.

LOG: Die Hostkonfigurationsdatei wird verwendet:

LOG: Die Computerkonfigurationsdatei von [C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config](file:C:/Windows/Microsoft.NET/Framework64/v4.0.30319/config/machine.config) wird verwendet.

LOG: Verweis nach der Richtlinie: System.Net.Http.Formatting, Version=5.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

LOG: Download von neuem URL file:///C:/Qt/Qt5.12.1/5.12.1/msvc2017_64/bin/System.Net.Http.Formatting.DLL.

LOG: Download von neuem URL file:///C:/Qt/Qt5.12.1/5.12.1/msvc2017_64/bin/System.Net.Http.Formatting/System.Net.Http.Formatting.DLL.

LOG: Download von neuem URL file:///C:/Qt/Qt5.12.1/5.12.1/msvc2017_64/bin/System.Net.Http.Formatting.EXE.

LOG: Download von neuem URL file:///C:/Qt/Qt5.12.1/5.12.1/msvc2017_64/bin/System.Net.Http.Formatting/System.Net.Http.Formatting.EXE.

LOG: Download von neuem URL file:///D:/_SDC/SdcSiveillanceLR_x64/System.Net.Http.Formatting.DLL.

WRN: Der Vergleich des Assemblynamens führte zum Konflikt: Buildnummer.

LOG: Download von neuem URL file:///D:/_SDC/SdcSiveillanceLR_x64/System.Net.Http.Formatting/System.Net.Http.Formatting.DLL.

LOG: Download von neuem URL file:///D:/_SDC/SdcSiveillanceLR_x64/System.Net.Http.Formatting.EXE.

Please see if this advise works.. https://developer.milestonesys.com/s/question/0D53X0000ClM8XASQ0/running-sdk-within-a-windows-service-throws-fileio-exceptions-on-login

Thanks for the fast answer, tried this, but Enabling “Auto-generate binding redirects"” has no effect.

It seems to work only with exe Files.

Unfortunately I haven’t found a way to redirect bindings for COM components.

Found a stack overflow link to this problem, but also didn’t help…

https://stackoverflow.com/questions/53599316/how-to-do-binding-redirects-for-managed-com-component-server-marshalling

Could you tell us a bit about the structure of the application you are developing? It might help us reproduce the issue.

Something you could try is to manually edit the app.config file to contain the following:

<assemblyIdentity name=“someAssembly”

publicKeyToken=“32ab4ba45e0a69a1”

culture=“en-us” />

https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions

This should be done in the executing assembly and I would do it even if the executing assembly don’t need System.Net.Http.Formatting.

Thanks for your help. In the end I understood that the binding redirect has to be done in the app.config (more precisely “myapp.exe.config”) of the calling application, even if it is not a .NET application (C++ in my case)