emuikernel / wittytwitter

Automatically exported from code.google.com/p/wittytwitter
1 stars 0 forks source link

Globalization problems #67

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
hi, I am a developer from china and find there is a crash bug in witty.
and the exception message is that:

System.Reflection.TargetInvocationException was unhandled
  Message="Exception has been thrown by the target of an invocation."
  Source="mscorlib"
  StackTrace:
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, 
Object[] arguments, SignatureStruct& sig, MethodAttributes 
methodAttributes, RuntimeTypeHandle typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object
[] arguments, Signature sig, MethodAttributes methodAttributes, 
RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, 
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo 
culture, Boolean skipVisibilityChecks)
       at System.Delegate.DynamicInvokeImpl(Object[] args)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall
(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object 
source, Delegate callback, Object args, Boolean isSingleParameter, 
Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at 
System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext
(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at 
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCle
anup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext 
executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, 
Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr 
wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall
(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object 
source, Delegate callback, Object args, Boolean isSingleParameter, 
Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl
(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object 
args, Boolean isSingleParameter)
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority 
priority, Delegate method, Object arg)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, 
IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl
(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame 
frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at Witty.App.Main() in 
D:\Source\wittytwitter\Witty\Witty\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] 
args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence 
assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.FormatException
       Message="String was not recognized as a valid DateTime."
       Source="mscorlib"
       StackTrace:
            at System.DateTimeParse.ParseExact(String s, String format, 
DateTimeFormatInfo dtfi, DateTimeStyles style)
            at System.DateTime.ParseExact(String s, String format, 
IFormatProvider provider, DateTimeStyles style)
            at TwitterLib.TwitterNet.AddTweet(String text) in 
D:\Source\wittytwitter\Witty\TwitterLib\TwitterNet.cs:line 572
            at Witty.MainWindow.AddTweet(String tweetText) in 
D:\Source\wittytwitter\Witty\Witty\MainWindow.xaml.cs:line 273
       InnerException: 

In the TwitterNet.cs file,
there are 3 places to call the CultureInfo.CurrentCulture.
and since i am in china, the return value of CultureInfo.CurrentCulture is
"zh-CN".

And i change the CultureInfo.CurrentCulture to CultureInfo.GetCultureInfo
("en-US"), it works well.

Original issue reported on code.google.com by yeqiwei on 5 Jan 2008 at 3:29

GoogleCodeExporter commented 8 years ago
what are the three places?

Original comment by alan...@gmail.com on 1 Feb 2008 at 4:07

GoogleCodeExporter commented 8 years ago
Hi, I am a developer from Poland I have also discovered this problem. Witty 
crashes
and freezes in unexpected way, and I debbuged it to find the solution.

My CurrentCulture is pl-PL.

First, Witty just freezes on retrieving tweets (doing nothing and showing 
"Retrieving
tweets"), because of FormatException (String was not recognized as a valid 
DateTime)
in TwitterNet.cs in line 950. After changing CultureInfo.CurrentCulture into
CultureInfo.GetCultureInfo("en-US") (below, in line 953) it works as it should.

Windows was showing "Application encountered an problem and will be closed" 
when I
was trying to click "User" or "Options". 

Change also CultureInfo.CurrentCulture into CultureInfo.GetCultureInfo("en-US") 
in
lines 620 and 736 of TwitterNet.cs.

And now Witty is working smoothly.

Attached changed TwitterNet.cs working (for me) on non-US cultures.

Original comment by marcin.k...@gmail.com on 4 Mar 2008 at 6:57

Attachments: