Error: Single-threaded apartment - cannot instantiate ActiveX control
Error: Single-threaded apartment - cannot instantiate ActiveX control
15 Oct 2019, 14:25
Hi,
Use FxPro's cTrader and when try to add subscription service (paddle.com) to the indicator and such an error appears.
after press the button "Buy Now"
code of the indi:
protected override void Initialize() { VerifyLicence(); } public void VerifyLicence() { // Default Product Config in case we're unable to reach our servers on first run var productInfo = new PaddleProductConfig { ProductName = "Divergence (cTrader Indicator)", VendorName = "Divergence Pulse" }; // Initialize the SDK singleton with the config Paddle.Configure(apiKey, vendorId, productId, productInfo); // Set up events for Checkout. // We recommend handling the TransactionComplete and TransactionError events. // TransactionBegin is optional. //Paddle.Instance.TransactionCompleteEvent += Paddle_TransactionCompleteEvent; //Paddle.Instance.TransactionErrorEvent += Paddle_TransactionErrorEvent; //Paddle.Instance.TransactionBeginEvent += Paddle_TransactionBeginEvent; // Initialize the Product you'd like to work with PaddleProduct product = PaddleProduct.CreateProduct(productId); // Ask the Product to get it's latest state and info from the Paddle Platform product.Refresh(success => { // product data was successfully refreshed if (success) { if (!product.Activated) { // Product is not activated, so let's show the Product Access dialog to gatekeep your app Paddle.Instance.ShowProductAccessWindowForProduct(product); } Activated = product.Activated; if (Activated) Print("Divergence: Licence verified"); else Print("Divergence: Failed to verify licence. Please, activate this indicator on www.divergencepulse.com"); } else { // The SDK was unable to get the last info from the Paddle Platform. // We can show the Product Access dialog with the data provided in the PaddleProductConfig object. Paddle.Instance.ShowProductAccessWindowForProduct(product); } }); }
Is there a solution?
Replies
diiptrade
15 Oct 2019, 15:28
RE:
Panagiotis Charalampous said:
Hi D D,
It seems that your product needs a single threaded appartment to run. Therefore you should run it on a separate thread specifying the STA apartment state on the thread. See here.
Best Regards,
Panagiotis
Tried this solution, but nothing)
@diiptrade
PanagiotisCharalampous
15 Oct 2019, 15:52
Hi D D,
Since the exception is thrown from the third party tool, did you try contacting them? I don't think there is much more we can do to help you with this.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
15 Oct 2019, 15:02
Hi D D,
It seems that your product needs a single threaded appartment to run. Therefore you should run it on a separate thread specifying the STA apartment state on the thread. See here.
Best Regards,
Panagiotis
@PanagiotisCharalampous