A good lesson and experience

I was extremely busy during the last two weeks, since our project was at bug fixing phase, my team and I worked really hard on dealing with the bugs; We fixed two to three bugs everyday by average, I am very satisfied with the efficiency myself.

During this process, I encountered several very interesting issues.

  1. There was a crash bug with P1 priority, we all cannot reproduced it until one guy from US team provided a remote server that our product always crashed, after I logged onto that server and 20 minutes investigating, I was really surprised, the reason is one line of code written by myself, it is:

    DateTime.Parse(String.Format("{0}/{1}/{2} 00:00:00 AM", DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Year))

    Does this line of code has any problem, I definitely don’t think so before, but now, I understand, it only works under English format, once non-English format, under some format such as Chinese, the AM makes non sense; and… Under some formats (such as French), the code will throw FormatException and leads program crash…

  2. Another issue is a WPF related multi-threading issue, there is a module in our product used thread pool to invoke WMI APIs to get the drives' information, once done the thread updates a Boolean flag indicate it is ready to bind data onto UI, once the flag changes, it will notify WPF main thread (two WPF pages subscribed this), but the problem is, the one of them directly starts binding data, since it will be done in the thread created by thread pool, WPF does NOT allow this, an InvalidOperationException will be thrown and leads product crash.
  3. The solution is straight forward: Let main thread updates the Boolean flag, so that both two subscribing page can simply just wait for it and do the binding.

Interesting, hum:)




Leave a comment