In the current implementation, C# Interactive is not user friendly enough for widespread success.
Editing in the C# Interactive Window is too cumbersome except for very small code samples. The alternative, sending code from a cs file to C# Interactive with Ctr+E,Ctr+E, is usually not practical, because 1) a cs file has additional code mixed in that is not currently needed for interactive evaluation, and 2) interactive compiler directives are not available in the cs file.
Adding a csx editor to Visual Studio is a prerequisite to make C# interactive truly successful. This can be seen from F#, where F# interactive is heavily used by each and every F# programmer. See also https://docs.microsoft.com/en-us/dotnet/fsharp/tutorials/fsharp-interactive/.
@Daniel Babralace: "Microsoft should really expand ? to be used for all types [...]" That's exactly what they will do in C# 8. See also https://github.com/dotnet/roslyn/blob/master/docs/Language%20Feature%20Status.md and https://github.com/dotnet/csharplang/blob/master/proposals/nullable-reference-types.md.
I am happy to note that this suggestion has been at the very top ever since I wrote it more than five years ago. To understand its popularity, one can simply enter "billion dollar mistake" into any search engine.
Non-nullability is difficult to retrofit into a language like C#. There are many approaches, who solve the problem to varying degrees. Furthermore, the discussion is tricky, because people easily mix up the semantics of initialization, nullability, and optionality.
It is all the more exciting that non-null refs are now in the status of prototyping for the next version after C# 7 (see https://github.com/dotnet/roslyn/blob/master/docs/Language%20Feature%20Status.md).
Last not least: Several modern programming languages already _have_ null-avoidance features, such as F# (https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/values/null-values), Swift (https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Types.html#//apple_ref/swift/grammar/optional-type), or Rust (https://doc.rust-lang.org/std/option/).
There is a pater of 2003 from Microsoft Research: [Declaring and Checking Non-null Types in an Object-Oriented Language] (http://research.microsoft.com/en-us/um/people/leino/papers/krml109.pdf). Unfortunately, the initiative has not been followed through. However, some concepts look quite similar to what later became [NotNull] etc. in ReSharper.
@Vladislav: Yes, non-nullable reference types would make C# more "symmetric" (with nullable value types), which is in itself a good thing from a language design perspective.
As my suggestion has become somewhat popular, I would like to add more context to it. Null references were introduced in ALGOL in 1965. The language designer has famously described this as his "billion dollar mistake" (see
The error has been copied by the mainstream OO languages, inclusign C#. By now, the worldwide costs of preventing and fixing NullReferenceExceptions might easily be in the range of a billion dollars a year.
Given the seriousness of the problem, the correct thing to do would be to redesign C# (or even the .Net Framework) so that, by default, the usage of null is forbidden. To indicate that something might or might not exist, a new "Option<T>" or "Maybe<T>" type could be added, ideally with proper syntactical support in the language. An example of a .Net language who works like this is F#.
However, I don't think it is realistic to expect such a fundamental change in C#, a long-established mainstream language. Therefore, I have suggested the second-best solution, which is to add non-nullable reference types. Of course, this would make C# a bit more complicated, as we would then have four "contingency idioms" (nullable vs. non-nullable value types vs. reference types). But it would still be less complex and expensive than the combined effort of ReSharper/CodeRush, code contracts, coding conventions, documentation, and testing,
while still running the constant risk of NullReferenceExceptions.
510 votesunder review · 15 comments · Visual Studio IDE » Languages - F# Tools · Flag idea as inappropriate… · Admin →
Folders would be nice, or, as an alternative: Improving _object browser_ support in Visual Studio, so that the internal and private details of an F# project can be looked up in a structured way in "My Solution", as it is possible for other languages.