Contents

46 Articles
6 Comments

Search

1 month Ago

C# Handbook 7.0

Published by Marco on

 I announced almost exactly one year ago that I was rewriting the Encodo C# Handbook. The original was published almost exactly nine years ago. There were a few more releases as well as a few unpublished chapters.

I finally finished a version that I think I can once again recommend to my employees at Encodo. The major changes are:

  • The entire book is now a Git Repository (GitHub). All content is now in Markdown. Pull requests are welcome.
  • I’ve rewritten pretty much everything. I removed a lot of... [More]

2 months Ago

Adventures in .NET Standard 2.0-preview1

Published by Marco on

.NET Standard 2.0 is finally publicly available as a preview release. I couldn’t help myself and took a crack at converting parts of Quino to .NET Standard just to see where we stand. To keep me honest, I did all of my investigations on my MacBook Pro in MacOS.

IDEs and Tools

I installed Visual Studio for Mac, the latest JetBrains Rider EAP and .NET Standard 2.0-preview1. I already had Visual Studio Code with the C#/OmniSharp extensions installed. Everything installed easily and quickly and I... [More]

1 year Ago

Beware the Hype: .NET Core

Published by Marco on

The article .NET Core, a call to action by Mark Rendle exhorts everyone to “go go go”.

I say, “pump the brakes.”

RC => Beta => Alpha

Mark says, “The next wave of work must be undertaken by the wider .NET community, both inside and outside Microsoft.”

No. The next wave of work must be undertaken by the team building the product. This product is not even Beta yet. They have called the last two releases RC, but they aren’t: the API is still changing quite dramatically. For example, the article Announcing .NET... [More]

C# Handbook Rewrite Coming Soon

Published by Marco on

Encodo published its first C# Handbook and published it to its web site in 2008. At the time, we also published to several other standard places and got some good, positive feedback. Over the next year, I made some more changes and published new versions. The latest version is 1.5.2 and is available from Encodo’s web site. Since then, though I’ve made a few extra notes and corrected a few errors, but never published an official version again.

This is not because Encodo hasn’t improved or... [More]

API Design: The Road Not Taken

Published by Marco on

“Unwritten code requires no maintenance and introduces no cognitive load.”

As I was working on another part of Quino the other day, I noticed that the oft-discussed registration and configuration methods[1] were a bit clunkier than I’d have liked. To whit, the methods that I tended to use together for configuration had different return types and didn’t allow me to freely mix calls fluently.

The difference between Register and Use

The return type for Register methods is IServiceRegistrationHandler... [More]

2 years Ago

Profiling: that critical 3% (Part II)

Published by Marco on

 In part I of this series, we discussed some core concepts of profiling. In that article, we not only discussed the problem at hand, but also how to think about not only fixing performance problems, but reducing the likelihood that they get out of hand in the first place.

In this second part, we’ll go into detail and try to fix the problem.

Reëvaluating the Requirements

Since we have new requirements for an existing component, it’s time to reconsider the requirements for all stakeholders. In... [More]

Profiling: that critical 3% (Part I)

Published by Marco on

An oft-quoted bit of software-development sagacity is

“Premature optimization is the root of all evil.”
Donald Knuth

As is so often the case with quotes—especially those on the Internet[1]—this one has a slightly different meaning in context. The snippet above invites developers to overlook the word “premature” and interpret the received wisdom as “you don’t ever need to optimize.”

Instead, Knuth’s full quote actually tells you how much of your code is likely to be affected by performance issues that... [More]

ReSharper Unit Test Runner 9.x update

Published by Marco on

Way back in February, I wrote about my experiences with ReSharper 9 when it first came out. The following article provides an update, this time with version 9.2, released just last week.

tl;dr: I’m back to ReSharper 8.2.3 and am a bit worried about the state of the 9.x series of ReSharper. Ordinarily, JetBrains has eliminated performance, stability and functional issues by the first minor version-update (9.1), to say nothing of the second (9.2).

Test Runner

In the previous article, my main... [More]

C# 6 Features and C# 7 Design Notes

Published by Marco on

Microsoft has recently made a lot of their .NET code open-source. Not only is the code for many of the base libraries open-source but also the code for the runtime itself. On top of that, basic .NET development is now much more open to community involvement.

In that spirit, even endeavors like designing the features to be included in the next version of C# are online and open to all: C# Design Meeting Notes for Jan 21, 2015 by Mads Torgerson (GitHub).

C# 6 Recap

You may be surprised at the version number “7”—aren’t... [More]

Are you ready for ReSharper 9? Not for testing, you aren’t.

Published by Marco on

We’ve been using ReSharper at Encodo since version 4. And we regularly use a ton of other software from JetBrains[1]—so we’re big fans.

How to Upgrade R#

As long-time users of ReSharper, we’ve become accustomed to the following pattern of adoption for new major versions:

EAP

  1. Read about cool new features and improvements on the JetBrains blog
  2. Check out the EAP builds page
  3. Wait for star ratings to get higher than 2 out of 5
  4. Install EAP of next major version
  5. Run into issues/problems that make... [More]

3 years Ago

Configure IIS for passing static-file requests to ASP.Net/MVC

Published by Marc on

At Encodo we had several ASP.Net MVC projects what needed to serve some files with a custom MVC Controller/Action. The general problem with this is that IIS tries hard to serve simple files like PDF’s, pictures etc. with its static-file handler which is generally fine but not for files or lets say file-content served by our own action.

The goal is to switch off the static-file handling of IIS for some paths. One of the current projects came up with the following requirements so I did some... [More]

ASP.Net MVC Areas

Published by Marc on

After some initial skepticism regarding Areas, I now use them more and more when building new Web-Applications using ASP.Net MVC. Therefore, I decided to cover some of my thoughts and experiences in a blog post so others may get some inspiration out of it.

Before we start, here’s a link to a general introduction to the area feature of MVC. Check out this article if you are not yet familiar with Areas.

Furthermore, this topic is based on MVC 5 and C# 4 but may also apply to older versions too... [More]

Should you return null or an empty list?

Published by Marco on

I’ve seen a bunch of articles addressing this topic of late, so I’ve decided to weigh in.

The reason we frown on returning null from a method that returns a list or sequence is that we want to be able to freely use these sequences or lists with in a functional manner.

It seems to me that the proponents of “no nulls” are generally those who have a functional language at their disposal and the antagonists do not. In functional languages, we almost always return sequences instead of lists or... [More]

Working with EF Migrations and branches

Published by Marco on

The version of EF Migrations discussed in this article is 5.0.20627. The version of Quino is less relevant: the features discussed have been supported for years. For those in a hurry, there is a tl;dr near the end of the article.

We use Microsoft Entity Framework (EF) Migrations in one of our projects where we are unable to use Quino. We were initially happy to be able to automate database-schema changes. After using it for a while, we have decidedly mixed feelings.

As developers of our own... [More]

Dealing with improper disposal in WCF clients

Published by Marco on

There’s an old problem in generated WCF clients in which the Dispose() method calls Close() on the client irrespective of whether there was a fault. If there was a fault, then the method should call Abort() instead. Failure to do so causes another exception, which masks the original exception. Client code will see the subsequent fault rather than the original one. A developer running the code in debug mode will have be misled as to what really happened.

You can see WCF Clients and the “Broken”... [More] by David Barrett