Some time ago I lost two days for finding trivial bug. It was done completely unconsciously. Anyway, as most of other bugs. Application started to behave quite strange – after launching, it crashed immediately. Probably you will ask yourself what it is unusual. I have started standard procedure – run application with connected a debugger. But debugger was useless. Application crashed without any notification disconnecting the debugger. I have not got any single clue that will help me to solve this riddle.
This error was caused by a mirror typo. It turns out that doing endless recursion in not being shown as an error or warning by the compiler. In my application, instead lowercase letter, capital letter has occurred in class property declaration:
private string test; public string Test { get { return this.Test; } set { if (this.test != value) { this.test = value; this.NotifyPropertyChanged(m => m.Test); } } }
Instead of:
return this.test;
following text has been entered:
return this.Test;
Correction of that trivial error took only few seconds. However, it was hard to find this error. Until this situation I was accustomed to the fact when an infinitive recursion appears we should get some exception – in most cases stack overflow exception. After getting this exception I know what kind of problem causes it and where I should start searching. Whereas, I have to find what causes the problem without of any suggestion. Finally I have found this place completely by accident.
W przypadku dziwnych błędów warto czasem zajrzeć do EventLog’a Windows’a są one przeważnie tam zapisywabe. Mnie to kilka razy uratowało przed żmudnym przeglądaniem wszystkiego 🙂
Pod warunkiem, że piszesz soft pod Windowsa. W przypadku Windows Phona nie ma dostępu do takich zabawek 🙂 .