Thursday, August 24, 2006

.NET Stuff

Html Agility Pack -- Parses html into XML. "Free" C# source code.
Must Have .NET Developer Tools -- David Hayden.

Awesome... Web Apps as Local Classes -- SteelPrice.Net
ASP.NET Applications without Web Projects -- Fritz Onion
WSCF - Schema-Based Contract-First Web Services -- thinktecture.com


From ms.public.dotnet.languages.csharp thread "Nice exceptions"

I usually create a class, called

EntryPoint.cs


[STAThread]
static void Main(string[] args)
{
try
{

Application.Run(new Form1()); //Whatever your startup form is

}

}
catch (Exception ex)
{
//Notify User
MessageBox.Show( "A (uncaught) exception has occured. MyApp
cannot continue." );
//Shut down application
Application.Exit( );
}
}


This will catch any uncaught exceptions.

But Jon is right.
You catch an general exception, but you're rethrowing it.
Thus something else must catch it, or you'll get the blow-up screen.


You should should google

try catch finally brad abrams

and you can read where

"You should be writing many many more

try/finally
blocks

and not so many
try/catch/finally

blocks.





wrote in message
news:1158866316.744452.190120@e3g2000cwe.googlegroups.com...
> I'm new to VS2005, I used VS2003 a bit, and I remember it didn't act
> like this.
>
> My code looks like :
>
> try
> {
> blah
> blah
> blah
> }
> catch (Exception)
> {
> MyOwnException myoe = new MyOwnException ("Error on receiving data");
> throw myoe;
> }
>
> And what I get when an error happens is a window telling me :
> "Application1 has encountered a problem and needs to close.
> Send Error Report Don't Send"
>
> Then after clicking either "Send" or "Not Send", the windows closes and
> the program vanishes.
>
> As far as I remember I'm catching the exception and the program should
> be keep working after that.
>
> Where's my fault ?
>

No comments: