?
Solved

error propagaton from atl to C# client

Posted on 2004-04-15
3
Medium Priority
?
295 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 100 total points
ID: 10846274
Catch(ComException e)
{
    Console.WriteLine( " The exception is {0}", e.ErrorCode);
}
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

765 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