Re: Thread dont start (c#)

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: BrunoSilveira_BR (BrunoSilveiraBR_at_discussions.microsoft.com)
Date: 08/10/04


Date: Tue, 10 Aug 2004 13:31:03 -0700

Hi John,

 first of all, thanks for the advice. I've implemented try catch blocks in
my code. But i still dont get any error. After change some security policies
in my server i've made the listener function to be called. but it seems that
the problem is the entrywritten event handler. I didn't see it, in the log
file.
 

"John Saunders" wrote:

> "BrunoSilveira_BR" <BrunoSilveira_BR@discussions.microsoft.com> wrote in
> message news:A4F8C750-5221-45BF-8529-79C853120BA1@microsoft.com...
>
> <snip>
>
> > The problem is: This application works in the windows 2000 pro and 2003
> > server, but when i try to use on my server, (windows 2000 server) the
> > thread.start method doesn't seems to work. I've created a log to debug my
> app
> > and i see that thread.start doesn't work.
>
> I don't see a single try-catch block in this code! If this code throws an
> exception, it will quietly exit, and you'll have no idea what happened.
> Instead, try this:
>
> public void entrypoint() //Main entry point for applications and services
> {
> try
> {
> Thread tl = new Thread(new ThreadStart(this.listener));
> tl.Start();
> sw.WriteLine("Thread Started at " + System.DateTime.Now.ToString() +
> ". EntryPoint reached.");
> }
> catch (Exception ex)
> {
> sw.WriteLine(ex.ToString());
> }
> finally
> {
> sw.Flush();
> }
> }
>
> protected void listener() //Starts log monitoring and event listeners
> {
> try
> {
> el.Log = "System";
> el.EnableRaisingEvents = true;
> el.EntryWritten += new
> EntryWrittenEventHandler(this.listener_insert);
> sw.WriteLine("Listener Started at " + System.DateTime.Now.ToString()
> + ". Listener reached.");
> }
> catch (Exception ex)
> {
> sw.WriteLine(ex.ToString());
> }
> finally
> {
> sw.Flush();
> }
> }
> --
> John Saunders
> johnwsaundersiii at hotmail
>
>
>



Relevant Pages

  • Re: Vector and derived classes objects
    ... > wont be called for the objects the pointer points to, hence I dont see ... > any way an exception can be thrown there with my push_back. ... Josuttis as also mentiones that in his STL book. ...
    (comp.lang.cpp)
  • Re: Monte Carlo computer go methods
    ... When I hear of these rapid advancements, ... mostly what every book says: lots of study, trying to play the moves they learn even if they dont understand them, reading, counting liberties, never play a move which one has been told is bad *until* they are sure this is an exception, etc. ...
    (rec.games.go)
  • Re: inheritance question
    ... With the sample code below i get the error that i dont have enough ... arguments for the constructor i dont understand why i am getting that ... ie the "path" which was followed to reach the exception. ...
    (comp.lang.ruby)
  • Re: Threads and Exceptions
    ... you dont have a try catch in the function then you dont get notified ... about the unhandled exception. ... simply watches the stream until an escape character appears in the ... I launch a watchdog function with its own thread. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: System.Directoryservices getting TxIsolationLevel exeption?
    ... exception that was thrown and rethrowing it with a more generic exception. ... If you ever do catch and rethrow, ... > Hi Joe.. ... > I dont know if this makes any different but I am trying to add a user ...
    (microsoft.public.dotnet.framework.aspnet.security)