Stream.Length throws NotSupportedException

Stream.Length only works on Stream implementations where seeking is available. You can usually check to see if Stream.CanSeek is true. Many streams, since they’re being streamed, are of a nature where it’s impossible to know the length in advance. If you must know the length, you may need to actually buffer the entire stream, loading … Read more

Automapper 3.0 – This type is not supported on this platform IMapperRegistry

We had the same issue on our build server. MsTest seemed to remove DLLs it deemed unnecessary (note : this claim is only an educated guess). To fix it, add an explicit call to something in AutoMapper.Net4.dll. For instance, with the class ListSourceMapper : var useless = new ListSourceMapper() Adding this to a project which … Read more

When to use InvalidOperationException or NotSupportedException?

The MSDN only has one bit of guidance on this precise topic, on NotSupportedException: For scenarios where it is sometimes possible for the object to perform the requested operation, and the object state determines whether the operation can be performed, see InvalidOperationException. What follows is purely my own interpretation of the rule: If the object’s … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)