Export to GitHub

ncrontab - issue #5

Method NCrontabViewer.MainForm.Diff does not work with DateTime-Strings of specific locales


Posted on Jan 26, 2011 by Swift Bear

The current release implementation (version 0.2) of NCrontabViewer.MainForm.Diff does not work with DateTime-Strings of specific locales. Example: try to use the application on a computer with German locale. Reason: the length of the short weekday name is just 2 (not 3).

Possible workaround:

Change line 138 of MainForm.cs to var timeString = occurance.ToString("ddd dd, MMM yyyy HH:mm", CultureInfo.InvariantCulture);

http://code.google.com/p/ncrontab/source/browse/tags/0.2/src/NCrontabViewer/MainForm.cs#138

Comment #1

Posted on Jan 26, 2011 by Massive Ox

I tested in a German culture and I get the error shown below. Is this what you are seeing and mean by it not working in a culture where weekday names are not 3 charaters wide?

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex at System.Text.StringBuilder.Append(String value, Int32 startIndex, Int32 count) at NCrontabViewer.MainForm.Diff(String oldString, String newString, Int32 index, Int32 length, StringBuilder builder) in c:\ncrontab-0.2\src\NCrontabViewer\MainForm.cs:line 189 at NCrontabViewer.MainForm.DoCrontabbingImpl() in c:\ncrontab-0.2\src\NCrontabViewer\MainForm.cs:line 167 at NCrontabViewer.MainForm.DoCrontabbing() in c:\ncrontab-0.2\src\NCrontabViewer\MainForm.cs:line 78 at NCrontabViewer.MainForm.Timer_Tick(Object sender, EventArgs args) in c:\ncrontab-0.2\src\NCrontabViewer\MainForm.cs:line 68 at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Comment #2

Posted on Jan 27, 2011 by Swift Bear

Exactly!

Comment #3

Posted on Jan 28, 2011 by Massive Ox

(No comment was entered for this change.)

Status: Duplicate

Labels:
Type-Defect Priority-Medium