titanium-as / TitaniumAS.Opc.Client

Open source .NET client library for OPC DA
MIT License
193 stars 94 forks source link

Using TitaniumAS in Unity - Security error #41

Open walkersa opened 5 years ago

walkersa commented 5 years ago

I'm attempting to use your project within Unity3D but I'm getting a Initialize Security issue.

Full error note:

ExternalException: CoInitializeSecurity: Security must be initialized before any interfaces are marshalled or unmarshalled. It cannot be changed once initialized.

TitaniumAS.Opc.Client.Interop.System.Com.InitializeSecurity () (at <90125a9bf9174c0aae2889f6f6adea56>:0) TitaniumAS.Opc.Client.Bootstrap.Initialize () (at <90125a9bf9174c0aae2889f6f6adea56>:0) Rethrow as OpcClientException: Unable to initialize OPC DA client. It should run under MTA apartment state due to CoInitializeSecurity call. See http://www.pinvoke.net/default.aspx/ole32/CoInitializeSecurity.html for details. TitaniumAS.Opc.Client.Bootstrap.Initialize () (at <90125a9bf9174c0aae2889f6f6adea56>:0) Connection.OnEnable () (at Assets/Scripts/Connection.cs:19)

I'm struggling to find where I override the current security settings with the settings specified at the URL in the error message.

Any help would be great appreciated.

Thanks