codeice / linqtoexcel

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

Transformation does not accept a null result? #62

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

excel.AddMapping<Order>(o => o.StringProperty, "Header", val => null);

var results = (from o in excel.Worksheet<Order>(0)
               where o.AnotherProperty != null
               select o).ToList();

What is the expected output? What do you see instead?

I expect the StringProperty of each object to contain the value null.
Instead when the query is executed a NullReferenceException is thrown.

What version of the product are you using? On what operating system?

1.6.0.0 from NuGet
Windows 7 x64 (Using x86 binary)

Please provide any additional information below.

This is a cut down example, but displays the core of my problem.

Unless I am missing something, it seems as though if the result of the 
Func<string,object> transformation returns a null value, even though the 
property I am mapping to is a string, an exception is raised.

Original issue reported on code.google.com by tim.sirm...@gmail.com on 15 Feb 2012 at 11:48

GoogleCodeExporter commented 9 years ago
Thanks Tim, I'll be looking into this.

Original comment by paulyo...@gmail.com on 16 Feb 2012 at 4:34

GoogleCodeExporter commented 9 years ago
This is fixed in version 1.6.2

Original comment by paulyo...@gmail.com on 16 Mar 2012 at 1:29

GoogleCodeExporter commented 9 years ago
Thank you, I shall try out the new build.

Original comment by tim.sirm...@gmail.com on 17 Mar 2012 at 5:56