System.Diagnostics.Contracts .net 3.5

Mar 24, 2011 at 8:14 PM

Just back to DotSpatial after a long break.  I search the best I could to get back up to speed but didn't find this problem described.


When building for .net 3.5 I get an error here

namespace DotSpatial.Serialization{

   public class XmlDeserializer    {        

      public T Deserialize<T>(string xml)      




Saying both "requires" and "IsNullOrWhiteSpace"  are not defined.   Which is true since they are in frame work version 4.0



The smae error comes up in many other places also.  


Is .net 4 required for DotSpatial now?



Mar 24, 2011 at 10:25 PM

Actually I'm glad you brought this up. Just last week we had a presentation here in Idaho from someone who is trying to build a fully Mono version of DotSpatial and it turns out that Mono isn't close to being 4.0 compliant yet, so he is having to undo a lot of .NET 4 stuff to get his Mono version to work. This IsNullOrWhiteSpace issue is a good example of one he had to undo to make it compile 3.5. 

So bottom line is, yes, DS is 4.0 based now, however there may be some merit to trying to keep any specific 4.0 stuff out to simplify the Mono port...

- Dan

Apr 19, 2011 at 4:20 PM
Edited Apr 19, 2011 at 9:40 PM

It looks like Code Contracts are available for .Net 3.5 at

If so, you've got the option of including the appropriate assembly with your code instead of ripping out or modifying what's there.