Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, you need to check <code>Log</code> object for multithread support. If it works in main thread does not mean that it works in another thread well at same time. When work with multiple threads you always need to keep in mind about concurrency and other important rules. At least, may be you should place <code>Log</code> into <code>lock</code> statement (I don't know internal structure of your <code>Log</code> object).</p> <p>Second, don't think that <code>Log</code> not throws exceptions or exceptions don't exists inside <code>catch</code> block. Is quite possible that thread crashes here:</p> <pre><code> catch (Exception ex) { Log.Write("Worker exception : " + ex); } </code></pre> <p>Third, try simpliest and safest logging first for your debug purposes. Usually Windows Services logs their events into system journal. But it not well suited for debugging, it is rather a part of Service "interface". Try to use <code>Trace</code> class from <code>System.Diagnostics</code>.</p> <pre><code>using System.Diagnostics; ... catch (Exception ex) { Trace.WriteLine("Worker exception : " + ex); } </code></pre> <p><strong>For multithreaded applications you need more accurately write, verify and debug every step of your code before think that it works as expected. Multithreading in most cases significantly increases the complexity of development.</strong></p> <p>Creation of Service applications is also not a trivial task. For example using of forms in Services is strongly discouraged and complicates debugging.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload