HighTechTalks DotNet Forums  

Err.Raise in ES component

Dotnet Framework (Component Services) microsoft.public.dotnet.framework.component_services


Discuss Err.Raise in ES component in the Dotnet Framework (Component Services) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ramesh
 
Posts: n/a

Default Err.Raise in ES component - 11-02-2005 , 03:46 PM






I have a EnterpriseServices (ES) component with custom Err.Raise statement
Err.Raise(vbObjectError + 9100). When the client tries to trap the error, the
err number that is returned from ES component is 5, instead of -2147212404.

Kinda weird.

Any help is greatly appreciated?


Reply With Quote
  #2  
Old   
Morten Abrahamsen
 
Posts: n/a

Default Re: Err.Raise in ES component - 11-06-2005 , 04:16 PM






I'm not certain about your particular case, but I assume you are hosting
your ES component in a Server activated "ES application".

ES has two modes for communication that among other things will affect
how exceptions are treated. Mode 1 is COM Interop with simple
(blittable) types, and mode 2 is full .Net serialization.

Depending on which mode is chosen (this decision is an internal working
of ES) you will see two different error strategies. If it is in "COM
Interop" mode it will either give you one of the already known .Net
exceptions, or the generic COMException.

If it is in .Net serializer mode, it will give you the custom exceptions
you are using.

Anyways, try adding the plain object type to your method signature and
see if it works now. Adding a non-blittable type like "object" will
force it into .Net Serializer mode, and you should get the expected
exception behavior.

Unfortunately there is no way to force ".Net Serializer" and full
exception fidelity mode without affacting the method signature or some
security settings.

Hope this helps,

Morty

---- Added Object Type sample ----
public void Test(object myObject, string var, string var2)
{
}
---



Ramesh wrote:
Quote:
I have a EnterpriseServices (ES) component with custom Err.Raise statement
Err.Raise(vbObjectError + 9100). When the client tries to trap the error, the
err number that is returned from ES component is 5, instead of -2147212404.

Kinda weird.

Any help is greatly appreciated?


Reply With Quote
  #3  
Old   
Ramesh
 
Posts: n/a

Default Re: Err.Raise in ES component - 11-07-2005 , 08:41 AM



Thanks Morty,

And whatever you mentioned is true.

There is a marshalling problem in custom Err#, and Microsoft has provided me
a workaround of throwing COM exception like this:

Throw New COMException(Err.Description, vbObjectError + 9100)

And it works.

Thanks again,


"Morten Abrahamsen" wrote:

Quote:
I'm not certain about your particular case, but I assume you are hosting
your ES component in a Server activated "ES application".

ES has two modes for communication that among other things will affect
how exceptions are treated. Mode 1 is COM Interop with simple
(blittable) types, and mode 2 is full .Net serialization.

Depending on which mode is chosen (this decision is an internal working
of ES) you will see two different error strategies. If it is in "COM
Interop" mode it will either give you one of the already known .Net
exceptions, or the generic COMException.

If it is in .Net serializer mode, it will give you the custom exceptions
you are using.

Anyways, try adding the plain object type to your method signature and
see if it works now. Adding a non-blittable type like "object" will
force it into .Net Serializer mode, and you should get the expected
exception behavior.

Unfortunately there is no way to force ".Net Serializer" and full
exception fidelity mode without affacting the method signature or some
security settings.

Hope this helps,

Morty

---- Added Object Type sample ----
public void Test(object myObject, string var, string var2)
{
}
---



Ramesh wrote:
I have a EnterpriseServices (ES) component with custom Err.Raise statement
Err.Raise(vbObjectError + 9100). When the client tries to trap the error, the
err number that is returned from ES component is 5, instead of -2147212404.

Kinda weird.

Any help is greatly appreciated?



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.