Error #90584568 Can not create instance.

Created at 16 Mar 2017, 09:39
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
jaredthirsk's avatar

jaredthirsk

Joined 18.12.2015

Error #90584568 Can not create instance.
16 Mar 2017, 09:39


Hi,

I've been upgrading to Visual Studio 2017, and I am using some DLLs dual-targeted to net462 and netstandard (1.5 or lower).  I'm not sure if that's causing an issue or if I am only using the NET462 DLLs.

I was trying to get things going in cAlgo again but now I get this when trying to start my algo in cAlgo:

16/03/2017 01:24:24.065 | Error #90584568: Can not create instance.

And if I try backtesting:

16/03/2017 01:33:51.806 | Backtesting stopped: Error #90583872 occurred

Does anyone know what the issue is or how to troubleshoot?  I attached Visual Studio but I don't even get a debugger when I turn on break on all exceptions.

 

JustDecompile tells me cAlgo is targeting .NET 4.0.  Is this true?  If so, why is the target .NET Framework for cAlgo 4.0?  It would seem to be good if it supported .NET 4.6.2, because that supports .NET Standard 1.5 DLLs, and more and more of the .NET world is rapidly going in the direction of .NET Standard.  Also, Microsoft has ended support for 4.0, 4.5, and 4.5.1 so there would seem to be absolutely no good reason to still target it.  Perhaps I will make a separate thread for this issue.


@jaredthirsk
Replies

jaredthirsk
16 Mar 2017, 10:06

Oh I turned off "Just my code" when debugging and get a NullReferenceException in Frontend.CrossDomain:

System.NullReferenceException occurred
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Frontend.CrossDomain
  StackTrace:
   at Frontend.CrossDomain.Wrapper.DesktopAlgoActivator.CreateInstance[TAlgo](Type clrType, Dictionary`2 parameterValues)

 


@jaredthirsk

jaredthirsk
16 Mar 2017, 10:10

The debugger also says clrType is null.  So maybe it is having trouble loading my type -- I seem to recall I had trouble before if I didn't reference all of my DLL's (I have a lot of them.)  I will try to ensure I have all DLLs added....


@jaredthirsk

jaredthirsk
20 Mar 2017, 04:03

[Fixed] (but it's ugly)

Ok, I've got my .NET Core dlls working without errors!  (I can start a bot, backtest, and optimize.)

What I did:

  1. Turn on fusion log to detect .NET assembly loading problems.  Ran fuslogvw.exe to help me see the logs, or look at them on disk.
  2. In my bot, I added some Microsoft references: System.Collections, System.Threading, etc.  Not sure this helped
  3. Added some assembly redirects as needed in the cAlgo.exe.config (in some obscure folder in AppData\Local\Apps\2.0\....garbagenames...\cAlgo.exe.config
  4. Copied missing DLLs into this folder as well.

I'll probably have to repeat this the next time a new version of cAlgo comes out.  I will write a script to automate it if I have to.

Anyway, Spotware, if you can make sure .NET Core development is a first class experience, that would seem like a good thing.  And anyone, if I am missing something that could make this easier, please let me know.

 

------------

Appendix - Assembly redirects I added to cAlgo.exe.config:

<dependentAssembly>
        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
      </dependentAssembly>
	  <dependentAssembly>
        <assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
	  <dependentAssembly>
        <assemblyIdentity name="System.Collections" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
      </dependentAssembly>
	  <dependentAssembly>
        <assemblyIdentity name="System.Diagnostics.Debug" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
      </dependentAssembly>
	  <dependentAssembly>
        <assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
      </dependentAssembly>
	  <dependentAssembly>
        <assemblyIdentity name="System.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.0.0.0-4.0.12.0" newVersion="4.0.12.0" />
      </dependentAssembly>
	  <dependentAssembly>
        <assemblyIdentity name="System.Collections.Concurrent" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
      </dependentAssembly>
	  <dependentAssembly>
        <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
      </dependentAssembly>
	  

 


@jaredthirsk