.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How does System.Threading.Timer work (implementation details)

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :.NET Framework

I've read a bunch of articles on the different .NET timers and still don't have a good understanding how the System.Threading.Timer class works.  My concern is whether I'm creating a bunch of timer threads in the thread pool.  I have this concern because one article said something about System.Threading.Timer using a thread pool thread to WAIT on the timer.  I'm hoping that each System.Threading.Timer class I create doesn't create a thread pool timer thread waiting on my timer interval.  I assume not.  Which is why I would like to know how it actually works.

For instance, let's say I create 50 System.Threading.Timer objects with a 5 second interval.  What happens?  Is there some interop call into unmanaged code which creates some timer resources and somehow signals some managed code when a timer has elapsed at which point the managed code queues a work item to the thread pool?  So in my example, at roughly the same point in time .NET would queue 50 work items to the thread pool?



View Complete Post

More Related Resource Links

Team System: Customizing Work Items


Team Foundation Server's work iIem tracking system provides a number of advanced customization options.This article explores custom control support that lets you link to date, enhance the user experience, present data, and more.

Brian A. Randell

MSDN Magazine October 2009

Team System: Work Items and Undo Support


Add support for work items to the Team Foundation Server version control add-in.

Brian A. Randell

MSDN Magazine September 2007

Team System: Work Item Tracking


In this column, Brian Randell explains how to build a simple Work Item explorer and demonstrates the core operations needed to add work item support when building your own add-in.

Brian A. Randell

MSDN Magazine April 2007

System.Threading AND email


Hi guys,

I really need some help (and also some code example), in how to use System.Threading to send emails.

The issue is:

a) I have a function that sends emails;

b) But I don't want to keep the customers waiting for the email being sent;

c) so, I figure it out that the System.Threading is the best way to do that; But I don't know how exactly I cant use it.

PLEASE, i'm VB - not C# - developer, and I really appreciate help in that language.

I can't use Windows Services or SQL Jobs...

Could you help me on this?



System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server

System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an obje


Hi, i have a Problem, i made a ASP.NET Page with VS2010 and now i want to run it on a iis6 (windows server 2003) and i get the message:

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.


Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.


Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]

   Bestellung.Bestellung.ImageButton1_Click(Object sender, ImageClickEventArgs e) in D:\foo.aspx.cs:71

   System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +115

   System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +120

   System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13


How to Set System.Windows.Controls.WebBrowser.Document Property , navigatetostring,stream DONT WORK


Hi , i search in google , bing , cuil and all of searchs provider for the solution of this problem :


I get HTML content from HTTPWebRequest(because is much requests and if i use WebBrowser control directly i get a lag and video processing unnecessary)


And i need  set System.Windows.Controls.WebBrowser.Document with this text.


"Solution" , use new methods call NavigateToString() or NavigateToStream()

BUT THIS PROBLEM , both DON'T work with <javascript src="something.js"> or <style src="something.css">

Navigates ONLY read and process content INSIDE this tags , no external files (like 'something.js')

Solution i encountred after two weeks of search

Process the text and replace the files by the content of that.

But this i think that is no real solution. (i tested , work , but not perfectly) * I write my own code because that post dont have source code.

for why you need to do that?

because i need interact with users after search , and use html's input to re-search again and process this file with all extern files is too slow

Any solutions?

C# Lenguage

Sorry for bad english, i'am brazilian.


System.Media - SoundPlayer PlayLooping() - Error When Another Timer Is Running


Recently I had a problem using SoundPlayer PlayLooping method.

Below is my problem and the solution I have found.

Hope this will help anybody with similar issues.

The issue is that as this is essentially a timer, if anther timer is operating at the same time the other timer will somehow interfere and the sound player will loose its file and playback computer noise.  A way around this seems to be to construct a manual timer for looping back the sound.

timer_LoopRinging.Enabled = true;

private void timer_LoopRinging_Tick(object sender, EventArgs e)


      SoundPlayer player = new

Custom Timer Job does not really work



I made a custom timer job to export some date in excel files. It works really good on my developmet computer.

I installed the solution on the customer’s server and activated the features. The timer job was well created. After that, I would test the job and I pushed the button “execute now” in Central Administration. After a few seconds I found a new entry in my Job History with the successfully finished job.


Job Title

run system.dioganistic.process to open notepad not work on production server


Hi I have try to open notepad from local machine test code thats work fine, but when I try the code in production server my code not open the note pad.

this is the code I am using


I have change .netframework >> config >> machine.config file <processModel to username="System" and password"Autogenerate"

even though this is not working then i create a individual application pool for this application , and set identity tab Predefine value to "Network service" value to "local service" and then "local system" non of these not run the process from vb.net code.

how do I solve this. I have seen one article says need to change IIS  logon tab to allow interact with desktop, but i cannot find this feature in IIS.

anybody to help me please......


Where is System.Threading.Parallel?


Where does one find the System.Threading.Parallel library? It is supposedly part of the BCL, according to ECMA 335, but Google only turned up three references to it, with one of them in the standard itself.

For those of you unfamiliar with this library, it is supposed to make parallel computing easier, by providing classes such as ParallelFor, ParallelWhile, and ParallelForEach.

Uri does not work when assigned to System.Windows.Forms.WebBrowser



I have this uri http://maps.google.com/maps/api/staticmap?size=622x276&maptype=roadmap%5C&markers=color:red%7Clabel:A%7C%41%52%4C%C3%98%56,SE&sensor=false 

probing a city in sweden called Arlöv (%7C%41%52%4C%C3%98%56)

The uri works perfectly when pasted into IE.

It works when i go through the HTTPRequest

But It does not work when assigned to the System.Windows.Forms.WebBrowser, like so:  

Dim url As String = "http://maps.goog

system.diagnotics.process Cannot work after Impersonate set to True


Dear All proferssional,

I need all ur help, i new in Visual Studio, currently just doing some modification on other person project due to some security issues. This application can run fine before i set the Impersonate to true in Web.Config, but after i set Impersonate = true, i get this information in Event Log

Faulting application java.exe, version, faulting module ntdll.dll, version 5.2.3790.3959, fault address 0x000000000003a7c0

In web.config, i set this tag

<identity impersonate="true" />

And inside my login screen, the below code have apply

        Dim strArgu As String = ""
        Dim processJar = New System.Diagnostics.Process()
        strArgu = " -classpath cryptcare.jar;commons-codec-1.3.jar com.maybank.care.ldapcontrols.LDAPConnector ""LOGON""" & " " & txtPFNo.Text.Trim() & " " & txtPwd.Text.Trim()

        processJar.StartInfo.FileName = "java"
        processJar.StartInfo.CreateNoWindow = True
        processJar.StartInfo.Arguments = strArgu
        processJar.StartInfo.WorkingDirectory = strWorkingDir
        processJar.StartInfo.UseShellExecute = False
        processJar.StartInfo.RedirectStandardOutput = True
        processJar.startInfo.UserName() = Syste

Exception Details: System.Net.WebException: The operation has timed out


Hi, I have a web page that uses System.Net.HttpWebRequest class that used to work perfectly fine for 2 years, and then all of a sudden I started to get the following error.

[WebException: The operation has timed out]
System.Net.HttpWebRequest.GetResponse() +5314029

Also, I tried the application on my local machine and it works fine, do you think it is a setting change on my hosting server?
I already tried the response.close and it didn't work.

COM Object Interop DLL generated on Visual Studio 2010 does not work on 64-bit system



When I add a COM object Example.dll as reference, it will automatically generate a file called Interop.ExampleLib.dll to my bin folder. It works fine on 32-bit system but when I try it on a 64-bit my program fails to run.

I replaced the Interop.ExampleLib.dll with one that I generated a while ago using Visual Studio 2008, and it works on both 32 and 64-bit system.

Anyone knows what's the problem?

Thanks in advance!




System.ServiceModel.Channels.Message class problem in work flow persistence


I have used following link to create a workflow to call web service(asmx) in workflow rehosting.


I have created the workflow successfully. But when i run the workflow and workflow goes for persistence it shows following pesistence related errors.

1.The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}SaveWorkflow was interrupted by an error.

2.Type 'System.ServiceModel.Channels.StreamedMessage' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types."

I think this error is related to serialization of Message class.

Can anyone suggest?




why doesnt System.Drawing work on Console Application?


hi all

i wanna do a project with openGL in console application.but System.Drawing doesnt work.what must i do?i'm waiting for ur replies.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend