Solved

error propagaton from atl to C# client

Posted on 2004-04-15
3
293 Views
Last Modified: 2012-08-13
We are in the process of converting ATL clients to C#.
However,I have not been able to make errors to get progated properly.
I have read that teh ATL component is reqired to support the ISupportErrorInfo interface for erro propagation to work.
Subsquently here is the point where error is raised from a ATL dll
else
{
CreateErrorInfo(&pErrorInfo);
            if(hSuccess)
            {
                  pErrorInfo->SetGUID(IID_IAirlineInfoObj);
                  pErrorInfo->SetDescription(SysAllocString(L"Data not found"));
                  IErrorInfo* _errInfo=NULL;
                  hSuccess=pErrorInfo->QueryInterface(IID_IErrorInfo,(void**)&_errInfo);
                  if(hSuccess)
                  {
                        SetErrorInfo(0,_errInfo);
                  }
            }
            return E_FAIL;
}
And the C# client tries to trap it as follows
catch(Exception e)
                  {
                           
                        Console.WriteLine( " The exception is {0}",System.Runtime.InteropServices.Marshal.GetHRForException(e));  
                  }
This does not work.How do i retrieve the data I had set on the IErrorInfo interface in the COM server?

0
Comment
Question by:ranadhir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
ptmcomp earned 25 total points
ID: 10846274
Catch(ComException e)
{
    Console.WriteLine( " The exception is {0}", e.ErrorCode);
}
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question