recently, we had to clean the database from all the testing data, when an error similar to the following appeared:
The value “” is not of type “System.Nullable`1[System.DateTime]” and cannot be used in this generic collection
The code I executed was:
IQuery query = DbManager.MySession.CreateQuery(“select max(dateObject.EndDate) from DateDomain dateObject”);
IList<DateTime?> list = query.List<DateTime?>();
When I debugged NHibernate code, I reached to the following AddAll() method in the ArrayHelper class:
152 // NH-specific
153 public static void AddAll(IList to, IList from)
155 foreach (object obj in from)
You can find the explanation of the error here.
Which brings us to the interesting question: why the implementation of IList Add method doesn’t consider the “nullability” of the T object? and why the parameter is of type IList ?!
Am I missing something? should I report it as a bug?
In the early days when the Internet was Blog-free, my machine was light and clean, it was barely Visual Sutdio, SQL Server Express (then it was called MSDE) , Office, MSN and IIS. I always believed in the light clean machine, no goofy software around.
Then Blogs started to appear, and more interesting blogs had my attention like Scott’s and Omar’s, and with it I started to learn about new software gadgets. From that day, I am addicted!
First it was the Ultimate Tools List, I browsed it, and out of interest I downloaded Launchy, AMAZING (can’t live without it)!! then Notepad++ then SyncToy, then Process Explorer, Cropper, and I couldn’t stop!
Now there are wonderful sites like FileHippo that is a prime source for new software gadgets and their update news. but the surprise was Wakoopa; who thought there would be a whole social community website built around software enthusiasm!
But anyway, I still believe in clean and light machines, I don’t download toys that I don’t need, and regularly monitor their effect on my machine; the beauty of both worlds 🙂