Create Object Issues from .net assembly

Created at 01 Nov 2014, 17:46
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!
VL

VLAV

Joined 17.05.2014

Create Object Issues from .net assembly
01 Nov 2014, 17:46


Hi,

I have created a class in .net which uses some xml files to initialize. Inside the constructor of this class I use XDocument.Load(@MyXmlFile) method to read the config xml files and initialize the fields in my class.  When I try to create an object of that class cAlgo  (I am using Visual Studio in debug mode)  I see that when the code execution pointer steps over the  XDocument.Load(@MyXmlFile) line the execution pointer exits the constructor prematurely, and as a result my object is not initialized properly. 

It looks to me as if  XDocument.Load(@MyXmlFile) line creates a new thread which is not synchronized with the main thread. 

Could you please advise what could be happening at the XDocument.Load(@MyXmlFile) line in my .net  class code?

I have tested my class in a C# test console application as well as in Matlab and it works fine.

Regards,

VLAV 

 


@VLAV
Replies

VLAV
03 Nov 2014, 14:28

RE:

VLAV said:

Hi,

I have created a class in .net which uses some xml files to initialize. Inside the constructor of this class I use XDocument.Load(@MyXmlFile) method to read the config xml files and initialize the fields in my class.  When I try to create an object of that class cAlgo  (I am using Visual Studio in debug mode)  I see that when the code execution pointer steps over the  XDocument.Load(@MyXmlFile) line the execution pointer exits the constructor prematurely, and as a result my object is not initialized properly. 

It looks to me as if  XDocument.Load(@MyXmlFile) line creates a new thread which is not synchronized with the main thread. 

Could you please advise what could be happening at the XDocument.Load(@MyXmlFile) line in my .net  class code?

I have tested my class in a C# test console application as well as in Matlab and it works fine.

Regards,

VLAV 

 

It looks I get an exception : 

Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

This happens only when the object is created in cAlgo. Any ideas on how to solve the problem will be highly appreciated.


@VLAV

Invalid
03 Nov 2014, 15:34

RE: RE:

Hi Vlav. Try to change permission of your cbot

[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FileSystem)]

 


@Invalid

VLAV
03 Nov 2014, 15:59

RE: RE: RE:

Invalid said:

Hi Vlav. Try to change permission of your cbot

[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FileSystem)]

 

Hi Invalid,

That solved my problem. Thank you very much!

Regards,

VLAV


@VLAV