Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Eikon COM /
avatar image
Question by duarte_quintela · Dec 28, 2016 at 01:43 PM · eikoneikon-com-apic#rdata

Exception while calling CreateRData on Dex2.RData

Hello,

I am implementing the 'Dex2Example' example and the code throws an exception while trying to retrieve the data. While I can retrieve data using the form, as soon as trigger the CreateRData as a console application it throws the said exception:

An exception of type 'System.InvalidCastException' occurred in e_webservice.exe but was not handled in user code. 

It's not possible to associate an object COM of type 'System.__ComObject' to the interface 'Dex2.IDex2Mgr3'. This operation has failed because the call QueryInterface in the COM component (...) RESULT: 0x80004002 (E_NOINTERFACE)

The excpetion is thrown on the line

MyRData = MyDex2Mgr.CreateRData(MyDex2Cookie);

mydex2cookie value is 1 and the connection status is 'suceeded'.

The MyDex2Mgr initialization is as follows:

 public void CreateDex2Mgr()
        {
            // Create the Dex2 manager
            MyDex2Mgr = MyEikonDesktopDataAPI.CreateDex2Mgr();

            // Initialize the Dex2 manager and retrieve a session cookie
            if (MyDex2Mgr != null)
                MyDex2Cookie = (MyDex2Mgr as IDex2Mgr2).Initialize(DEX2_MetadataCaller.DE_MC_ADC_UNKNOWN);
        }

Cheers,

Duarte

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Reply

  • Sort: 
avatar image
REFINITIV
Answer by Zhenya Kovalyov · Dec 29, 2016 at 04:59 AM

Hi @duarte_quintelauarte, there are a few things that you should do to make sure that your code will work just fine in the console application:

  • make sure that your console app is running in the single-threaded apartment mode, you can add [STAThread] attribute to your static void Main() method;
  • since the API is COM, you will need to run the event loop manually, as it is not present in the console apps; the easiest way is to reference the WindowsBase.dll assembly, and add the following routine to your class Program:
#region Dispatcher
        public static DispatcherFrame Frame; //the object is required in order to release the Windows message pump while executing asynchronous calls.

        public static void PushDispatcherFrame()
        {
            Dispatcher.PushFrame(GetDispatcherFrame());
        }

        public static void StopMessagePump()
        {
            Frame.Continue = false;
            Frame = null;
        }

        public static DispatcherFrame GetDispatcherFrame()
        {
            return Frame ?? (Frame = new DispatcherFrame());
        }
#endregion
  • after you have done this, you will need to call Program.PushDispatcherFrame() manually every time you execute any calls, and Program.StopMessagePump() when you receive a result;

Let me know if it works.

Comment
duarte_quintela

People who like this

1 Show 2 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
duarte_quintela · Dec 29, 2016 at 11:13 AM 0
Share

Hello @Zhenya_Kovalyov

I've implemented the Dispatcher Frames method and the [STAThread] attribute on the main function.

Now, I've got another error on

MyDex2Cookie = (MyDex2Mgr as IDex2Mgr2).Initialize(DEX2_MetadataCaller.DE_MC_ADC_UNKNOWN);

The exception is as follows:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' in eikon.exe

Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG

I have the following dll's referenced in my project:

- Interop.Dex2

- Interop.EikonDesktopDataAPI

Thank you for your time,

Duarte

avatar image
REFINITIV
Zhenya Kovalyov ♦♦ duarte_quintela · Jan 26, 2017 at 05:33 AM 0
Share

It still looks as if you are activating and using the object in different threads. Could you drop me an email at evgenij.kovalev@tr.com and we can have a look at your code together.

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
8 People are following this question.

Related Questions

RDATA batch request with individual Sdate parameters

Receiving timeouts from Eikon DEX2 COM API on earnings forecast data

Subscription status okay but no data updates

Excel API: formula builder - retreive data from local server

Eikon .net api: get index constituents

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges