[Mono-list] Why isnt this exception caught? What am I doing wrong

alanb alan.battersby at ntlworld.com
Sun Aug 10 18:41:38 EDT 2008


I have written some code to save a file to the fs. See code below.

	string fullpath = System.IO.Path.Combine(base_directory,filename);
	StreamWriter sw = new StreamWriter(fullpath);		
	try
	{
		sw.Write(generator.CodeText);
	}
	catch (Exception ex)
	{
		Console.WriteLine(ex.Message);
	}
	finally
	{
		sw.Close();
	}

All works fine when the path is correct but when wrong the catch is ignored
and I get

Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to
handle the exception.
System.IO.DirectoryNotFoundException: Directory not found
...

So please can someone tell me what is happening and why the catch above is
being ignored. I am using mono 1.91,
gtk-sharp2 2.12.0-2ububtu3 and using monodevelop 2.0alpha as my ide.
thanks
alan
-- 
View this message in context: http://www.nabble.com/Why-isnt-this-exception-caught--What-am-I-doing-wrong-tp18810805p18810805.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list