Ran across a weird exception when calling
System.Diagnostics.Process.Start( "http://www.someplace.com" );
Exception message:
The requested section was not present in the activation context
Apparently, the thread trying to start the browser must be marked
STAThread.
Simply added
[STAThread] attribute to the main() function, and all worked fine.
Google Groups : microsoft.public.dotnet.languages.csharp
Well, the
next search result explains it more fully. Apparently, using the
ProcessStartInfo parameter version of Process.Start to avoid having to set the thread apartment state.
MSDN Help on Process.Start talks about the need to set STAThread when using
ProcessStartInfo.UseShellExecute set to true, or when passing a path to Process.Start()
I'm a bit confused, cuz it crashes for me when I don't have STAThread on main(), and pass a url string...but then it works by setting ProcessStartInfo.UseShellExecute to true.