Avatar billede lifo Nybegynder
25. april 2004 - 00:27 Der er 1 løsning

Custom Exception og Remoting ?

Hej eksperter
jeg har et klient server program som jeg er i gang med at lave
jeg har lavet mine egne exceptions som jeg kaster fra serveren
og jeg kan godt fange dem på klienten
MEN mit problem er at jeg kan ikke på beskeden med over til klienten
da jeg fanger et exception over på klienten får jeg altid samme besked "Error in application"
håber at nogen kan hjælpe

jeg har lavet mine exception som dette eksempel
[Serializable]
public class LaastException : System.ApplicationException
{
private const string _customInfoKey = "CustomInfo";
private string _customInfo;
public LaastException ( string customInfo )
{
  _customInfo = customInfo;
}
public LaastException ( string message, string customInfo ) :
  base ( message )
{
  _customInfo = customInfo;
}
public LaastException (string message, string customInfo,
  Exception inner) : base ( message, inner )
{
  _customInfo = customInfo;
}
public LaastException (SerializationInfo info, StreamingContext context) : base( info, context )
{
  _customInfo = info.GetString( _customInfoKey );
}
public override void GetObjectData( SerializationInfo info,
  StreamingContext context )
{
  base.GetObjectData(info, context);
  info.AddValue( _customInfoKey, _customInfo );
}
public string CustomInfo
{
  get { return _customInfo; }
}
}
Avatar billede lifo Nybegynder
25. april 2004 - 01:55 #1
jeg har fundet ud af det 
jeg var bare lidt dum da jeg catchede min exception
jeg lavede det på denne måde
catch(LaastException ex )
{ MessageBox.Show("bla bla "+ex};}
og det skulle være
catch(LaastException ex )
{ MessageBox.Show("bla bla "+ex.CustomInfo};}


fejlen var at jeg var
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester