473,378 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

culture of timer threads bug?

I note that when I set a culture in the globalization section of the
web.config this is picked up and used for methods such as ToString() for
dates etc.
However, it is not picked up for timers which I create in my web service and
the culture (but not uiCulture) revert to the system default!

Does anyone know if this is a bug and how to get around it?

asp.net 1.1 web service

Thanks in advance.

namespace TestCultureWebService
{
public class Service1 : System.Web.Services.WebService
{
public Service1()
{
InitializeComponent();

string s = System.Threading.Thread.CurrentThread.CurrentCultu re.ToString();

_madeAt = DateTime.Now;
_timer = new System.Timers.Timer();
_timer.Enabled = true;
_timer.AutoReset = true;
_timer.Interval = 15000;
_timer.Elapsed += new System.Timers.ElapsedEventHandler(_timer_Elapsed);
}

System.Timers.Timer _timer;
DateTime _madeAt;

#region Component Designer generated code

//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion

[WebMethod]
public string HelloWorld()
{
string s = System.Threading.Thread.CurrentThread.CurrentCultu re.ToString();
return s + " " + _madeAt.ToShortDateString() + " " +
_madeAt.ToLongTimeString();
}

private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
string s1 =
System.Threading.Thread.CurrentThread.CurrentCultu re.ToString() + " " +
_madeAt.ToShortDateString() + " " + _madeAt.ToLongTimeString();
}
}
}

Mar 13 '06 #1
1 2092
I have logged a support call with MS and they have confirmed they can
reproduce the problem.
Thus far, they have not offered a solution except to write code yourself to
set the culture but the call is still open and I want them to refund me the
call.

Mar 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Amadej | last post by:
Hello everyone I have a beginner's questions about the System.Threading.Timer class behavior. I have been observing the thread count with Windows Task Manger and noticed that timers, after being...
2
by: steve | last post by:
Since System.Threading.Timer uses the threadpool to do its stuff what happens when (a) You try to create a timer and the thread pool is *exhausted* (b) The timer is due to fire AND all threads...
3
by: mjheitland | last post by:
Hi, I like to know how many threads are used by a Threading.Timer object. When I create a Threading.Timer object calling a short running method every 5 seconds I expected to have one additional...
3
by: Ashish | last post by:
I have a application in which culture settings are customizable, they dont depend on the machine settings on which the application is running, I need to make sure that all the threads running in...
9
by: Mark Rae | last post by:
Hi, I've seen several articles about using System Timers in ASP.NET solutions, specifically setting them up in Global.asax' Application_OnStart event. I'm thinking about the scenario where I...
20
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical code. Thread A handles call activity on telephone...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
2
by: Amit Dedhia | last post by:
Hi I am developing a scientific application which has moderate level image processing involved. In my application, there is a main application form which invokes another form. When this form...
5
by: John A. Bailo | last post by:
From a Windows service (NET 2.0) I want to launch serveral threads in a for loop that invokes a method using: new Thread(delegate() { myMethod(248);}).Start(); Will those threads stay...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.