RE: Biztalk problem deserializing a custom exception

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Just in case anyone cares:

here is how I resolved this one; You must implement a constructor like this:
Sorry about the formatting.

Ron


using System;
using System.Runtime.Serialization ;
using System.Security.Permissions;

namespace CSTcpClient
{
/// <summary>
/// Summary description for CSTcpClientException.
/// </summary>
///

[Serializable()]
public class CSTcpClientException : Exception
{
private Int32 _faultCode ;
private String _message ;
private String _detail ;





protected CSTcpClientException(SerializationInfo si, StreamingContext
context) : base(si,context) {
_faultCode = si.GetInt32("_faultCode");
_message = si.GetString("_message") ;
_detail = si.GetString("_detail") ;

}

[SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)]
public override void GetObjectData(SerializationInfo si, StreamingContext
context) {
base.GetObjectData(si,context);

si.AddValue("_faultCode",_faultCode );
si.AddValue("_message",_message );
si.AddValue("_detail",_detail);
}


public CSTcpClientException():base()
{
//
// TODO: Add constructor logic here
//
}
public void setFaultCode(int faultCode) {
this._faultCode = faultCode ;
}
public int getFaultCode() {
return this._faultCode ;
}
public void setMessage(String message) {
this._message = message ;
}
public String getMessage() {
return this._message ;
}
public void setDetail(String detail ) {
this._detail = detail ;
}
public String getDetail() {
return this._detail ;
}

}
}






"Ron J" wrote:

> I created a custom exception and the class has the [Serialize] attibute at
> the top of the class.
>
> In the event log when I force and error to happen in the orchestration (to
> get it to try to dehydrate) I get
>
> Exception Type: ServiceCreationException
> The constructor to deserialize an object of type
> CSTcpClient.CSTcpClientException was not found.
>
> This is the exception class
>
> Does anyone have an idea about what this means?
>
> Thanks
> Ron
>
>
> using System;
>
> namespace CSTcpClient
> {
> /// <summary>
> /// Summary description for CSTcpClientException.
> /// </summary>
> ///
>
> [Serializable]
> public class CSTcpClientException : Exception
> {
> private Int32 _faultCode ;
> private String _message ;
> private String _detail ;
>
> public CSTcpClientException():base()
> {
> //
> // TODO: Add constructor logic here
> //
> }
> public void setFaultCode(int faultCode) {
> this._faultCode = faultCode ;
> }
> public int getFaultCode() {
> return this._faultCode ;
> }
> public void setMessage(String message) {
> this._message = message ;
> }
> public String getMessage() {
> return this._message ;
> }
> public void setDetail(String detail ) {
> this._detail = detail ;
> }
> public String getDetail() {
> return this._detail ;
> }
>
> }
> }
>
>
>
>
>
>
.



Relevant Pages

  • Re: How do you check an array for a particular value?
    ... >> array once something is taken out. ... >> write a for loop to find the module first of all, ... > public void removeModule ... private String studentName; ...
    (comp.lang.java.help)
  • Cannot send an MP3 file as email attachment...
    ... I want to send an email with an MP3 file as attachment. ... private String from; ... public void setFrom ... Session session = Session.getDefaultInstance; ...
    (comp.lang.java.programmer)
  • Re: Help compiling castor ibm java example
    ... private String artist = null; ... public void setArtist{ ...
    (comp.lang.java.programmer)
  • Re: delegates
    ... It's a bit like the difference between a field that holds a reference type ... private string m_s; ... public event EventHandler E; ... public void remove_E ...
    (microsoft.public.dotnet.languages.csharp)
  • Biztalk problem deserializing a custom exception
    ... Exception Type: ServiceCreationException ... private String _message; ... public void setFaultCode(int faultCode) { ...
    (microsoft.public.biztalk.general)