What elements of .NET are missing in Mono? - c#

I mean library and syntax of C#.

For the class library, ask the Mono Class Library status page

C# 3.0 is supported fully.
C# 4.0 version works but considered 'preview' until MS compiler is finalized. There're even some language extensions, although I doubt if they will be ever backported to MS compiler.

You can view Mono's status updates (Like a Timeline, really), from their wiki.
Mono Status Report

There's a pretty in-depth analysis here from January of this year.
The Wikipedia article's "Current status and roadmap" looks helpful too.

There's no equivalent of VT fixup or anything related to unmanaged exports for that matter.
That's not surprising, though. Considering that you would have a hard time using something looking like a Windows DLL as .so or .dylib. ;-)
I am not sure, but mixed-mode hasn't been supported a few years ago when I wanted to use it.
Maybe they added it, but I don't think so. Might be the big fat mother of all worm cans to open for an X platform CLI implementation.

There are three aspects you need to consider.
Language
Framework
Runtime
Language:
Mono fully implements C# 2.0, and has almost complete support for 3.0. This means it supports all of the syntactical language features like generics, properties, anonymous methods/types, etc.
Mono supports Visual basic 8, but not 9.
Framework:
Mono fully implements ASP.NET and ADO.NET. Windows.Forms is mostly done.
WCF and WF are in progress.
WPF is not done, and is many years away from being done (if ever). I believe this is now a side project.
Linq-to-SQL is not yet finished.
Runtime:
The CLR has been almost fully implemented, including support for the DLR.
Your best two sources of information are probably the Mono home page (specifically the FAQ and the Status report), and the Wikipedia page on Mono.

Please have a look at the Mono Project Site or at the Wikipedia-Article.
But the last thing I heard is thet C# 3.0 is complete (except some LINQ-Features).

Related

C# - What will I miss if I start with .NET 2.0?

I got a book named "Pro C# 2005 and the .NET 2.0 Platform, Third Edition by Andrew Troelsen".
I am wondering whether I should buy the "Pro C# 2010 and the .NET 4 Platform, Fifth Edition" instead. Since, the latest version of .NET is 4.0. If I learn C# based on this old book, do I miss some critical parts of the C# language? Or, I can start with this book and learn new .NET 4.0 features with other resources.
Thank you
You can start with that book and learn C# 4.0 from elsewhere. This is what's been added after C# 2.0:
C# 3.0:
LINQ
lambdas
extension methods
expression trees
anonymous types
local type inferencing
automatic properties
object initializers
collection initializers
partial methods
C# 4.0
dynamic member lookup
covariant and contravariant generic type parameters
optional parameters and named arguments
parallelization framework (actually part of .NET 4, not C# 4.0 per se)
You will miss a lot. Most notably in my opinion, Linq. Linq changes the whole face of idiomatic C# so much that I could not reccommend starting with the old book.
I think you will be missing out on LINQ, which is quite a notable addition. If you are open to other reccomendations, I would say try Jon Skeet's C# In Depth. It gives a very good coverage of the various changes in the language from versions 2.0 to 4.0 (I purchased the early access edition).
Lambdas / LINQ are pretty huge.
C# 2 has generics, and it's good, but C# 3 and 4 have LINQ and dynamic typing, respectively, both of which are very powerful in their respective milieus.
And that's just to name two. There's a crap-ton more in there that you're missing out on.
If you can, always develop against the latest version.
You can certainly start with C# 2.0 and learn the basics. There are many great new features in C# 4.0, but many of them are advanced or what are called 'syntactic sugar' meaning it's a more terse way of writing something you could already do with C# 2.0.
There are many different posts about the new features you can reference, without buying a complete book on it:
http://www.15seconds.com/issue/080228.htm
http://code.msdn.microsoft.com/cs2010samples
I'd reccommend not spending the money up front, and checking out what the interweb has to offer.
Personally, I think 2.0 is the right version of C# to start with. If you're going to learn the language for the first time, then starting with 2.0 is totally fine. 2.0 is the major release of the core language.
From 3.0 some features have been added which are nothing but "syntactic sugars" and "time/typing savers", and which confuse beginners, and you're gonna have to post questions here like "whether I should use constructors or object initializers".
Of course, you'll not find the new features added in 3.0 and 4.0 in a book for 2.0. But just as you said, you can always be introduced with those from other resources.
I wouldn't recommend you start learning C# with such an old version.
If you have the money to buy the new edition you should go for it. There were a lot of changes since .net 2.0.
If buying a new book it's not possible for you at this moment you could start learning the basic stuff from that book and learn new features from online resources.
You would miss most of the new technologies.
3.0 introduced WPF, WCF and WF
3.5 gave us LINQ, and other related techniques like lambda expressions, extension methods...
4.0 brought the DLR, for dynamic typing.
A full summary of new features can be found on wikipedia.
LINQ isn't all you'll miss. A lot of technologies that were added to 3.0 with LINQ (and largely because of it) stand on their own merits and make it very worthwhile to adopt the latest version.
Lambdas
Anonymous Methods (might have been 2.0, can't remember at the moment)
Type Inference
Dynamic types in 4.0
Lots of new classes and improvements
I think you might be doing yourself a disservice if you cripple yourself with 2.0 if you don't really have to. The Framework is, after all, free, and so is the online documentation. Further, online tutorials abound, and you hve a plentiful resource for programming advice right here on StackOverflow.
MSDN has a helpful set of pages (start here) that tell you exactly what you will be missing out on when you target older versions of C# and the .Net Framework.
Remember when you target a C# version you are not just tying yourself to the language but to the matching .Net Framework - there is a whole bunch of new stuff in 2008 and then again in 2010 that you will miss out on by going .Net 2.0.
The major things you will want to know about that have come along since 2.0 include:
Linq (a powerful compiler-checked query language used for list/set processing and as an interface to ORM frameworks).
Anonymous types and delegates (lambda expressions). Need to store a list of some data fields you've gotten from a Linq expression, but don't need/want to define a whole new type just to store them? You don't have to anymore. Similarly, if you need to do something to each element of a list, or specify some operation to return a result, but don't want to define a named method, you don't have to. C# allows you to specify "anonymous" types and delegates, which are defined where they are used and are accessible only through the variable containing the delegate or data reference.
WPF (The next generation of UI development, it is an XML-based presentation layout definition that will EVENTUALLY replace WinForms and ASP.NET)
WCF - the next generation of web service classes, supporting built-in security features like encryption.
Microsoft Entity Framework - Microsoft's take on ORM frameworks like NHibernate
Dynamic typing - C# 4.0 allows for relaxed type restrictions by defining types or parameters as dynamic. This allows .NET to interface more seamlessly with assemblies or native APIs written in "duck-typed" languages (where the type is always dynamic, inferred from what you're trying to do with the instance)
Better covariance/contravariance support - .NET 4.0 allows you to specify that collections of a type can be treated as if they were a collection of a derived type, or an ancestor type.
The versions of .Net are all primarily similar, but the only thing you may glean by starting with 2.0 would be to get a history of where certain changes in the languages came from. That's more of an experience thing though. If you're not already trained in C#, it would be best to start at the very latest. The fundamentals of the language will still be the same. You'll also learn the latest techniques for accomplishing common tasks rather than learning an outdated method and then having to relearn it later and try to understand the differences and why it exists in the first place.
Start with the latest stuff. Don't learn from antiquated sources and then try to fill in the gaps with extraneous information.
Programming technologies change so fast as it is, why would you invest time reading such an old book? I'd get the newest one.
As well as the aforementioned Linq/lambdas etc, the later books will also cover technologies such as WPF which has pretty much replaced winforms for desktop development, and WCF which is the common communications method now, so I'd try and get a later book.

Why C# is an open standard but .NET is not?

Why C# is an open standard but .NET is not? What is the point in this? Why Microsoft decide to open only some part of their .NET?
Various parts of the .NET runtime are indeed standardised by ECMA just like C# - CIL, the CLI, the CLS.
.NET is the runtime and C# is the language. C# can be compiled and run on other runtimes, such as Mono. I am actually not aware of any other runtimes besides Mono, but since the spec for C# is open, you could read it and make your own runtime. ;)
C#, like Java, C, C++, etc. is just a language definition. In and of itself, it does nothing. It defines the means by which a user can define a program or procedure and interface with external libraries.
The .NET framework, on the other hand, is not a language. It's a class library and development framework.
Actually, there is an open standard (ECMA 335 for the runtime api instead of ECMA 334 for the language).
Going beyond this, the source code for Microsoft's implementation of .Net is available and there are multiple separate implementations (the most prominent of which by far is mono).
There is some additional concern about patent encumbrance. However, Microsoft has also issued a legally binding and irrevocable community promise on the .Net platform that covers both specifications (a lot of people miss the legally binding part).
I assume you mean the framework. I guess they want to maintain control over the library implementation on Windows. There is nothing stopping someone from implementing a call-compatible version of all or part of the framework based on their own source as was done by Mono.

Is C# used anywhere besides .NET programming?

It's my understanding that C#, though created by Microsoft, is a programming language that can be used or implemented for things other than .NET programming. For example, I could create a compiler for C# to target native x86 or other processors or even a JVM. Is my understanding incorrect? Does anyone know if C# is used for anything besides .NET?
C# is used for an experimental operating system called 'Singularity' which is written in the managed level from the ground up. An interesting project to watch!
Edit: Thanks Jörg W Mittag for his comment - Helios is actually a modified form of Singularity to support satellite kernels, to quote from the paper I am reading right now 'Helios is an operating system designed to simplify the task of writing, deploying and tuning applications for heterogenous platforms. Helios introduces satellite kernels, which export a single uniform set of OS abstractions across CPUs of disparate architectures and performance characteristics. Satellite Kernels allows developer to write applications against familiar operating system APIs and abstractions.'...interesting...
Hope this helps,
Best regards,
Tom.
You are correct that it can be used for other things. It's a language specification...you can compile it into anything you like if you take the time, but it'd be a tremendous effort.
I don't know of any other uses besides Mono as jrcs3 said, but hopefully Eric Lippert will chime in and give you a compiler point of view on C#
C# itself is a specification specified by the ECMA that "specifies the form and establishes the interpretation of programs written in the C# programming language." as is the CLR. The most popular implementation of these is currently provided by Microsoft, which is the C#.net that you know. C# and the CLR are open standards, meaning that anyone can implement them themselves, hence the formation of mono, a C# compiler for mac/linux. Compare this to java, who's only implementation is provided by sun. It's not an open standard, so you can't create your own implementations.
from wikipedia:
Mono "An open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET"
DotGNU "is a part of the GNU Project that aims to provide a free software replacement for Microsoft's .NET Framework"
Dot Net Anywhere is a .net CIL interpreter for targeting embedded systems.
As far as I'm aware, all currently existing implementations of C# build to CIL and run in the .NET CLR or compatible environment, and the only alternative to the .NET CLR I am aware of is Mono.
In other words, all current versions of C# build to run in .NET or Mono.
.NET and Mono use the same 'binaries', so effectively all current C# compilers have only one target.
Another area of use is for iPhone app development (and I believe iPad now as well) via MonoTouch.
What is MonoTouch?
MonoTouch allows developers to create C# and .NET based applications that run on Apple's iPhone and Apple's iPod Touch devices, while taking advantage of the iPhone APIs and reusing both code and libraries that have been built for .NET, as well as existing skills.
Roughly speaking, it goes like this:
MonoTouch -> MonoDevelop/C# -> write an iPhone app -> compiled to native code -> iPhone app.
Relevant links:
MonoTouch
Writing your First IPhone application in C# using MonoTouch
Note that Unity 3D also allows "C# Scripts", and compiles to target Mac, Windows, Web, Wii and iPhone (and therefore iPad).
There are indeed tools to convert a .NET assembly to a standalone executable or library, so that you don't need your clients to have the .NET framework. This also further protects your code against reverse-engineering to some degree -- you can't use Reflector to see the .NET source on a native binary.
See Remotesoft Salamander .NET Protector, for instance.
But, that isn't strictly C# -> native; Salamander converts the MSIL to native code.
On the other hand, there is at least one academic project on making a C# -> native compiler using LLVM, called LLVM#.
You can compile a C# program on Mono. But that probably doesn't count.
Mono is an alternative implementation of the Common Language Infrastructure (CLI) that runs on Linux and various other operating systems. As mentioned in other places, both C# and the CLI are ECMA standards and can be implemented by anyone who cares to do so.
Rotor is another non .NET implementation.
You can use it on iPod apps if you use MonoTouch.

Are there any drawbacks to learning C# in MonoDevelop?

I want to learn C# because... It seems to be a pretty marketable language these days. More than C, not so much as PHP/MySQL in my area, but I'd rather be a software developer than a web developer. Anyways, I'm running linux, and I have no hope of working on a windows platform until I buy a new computer. So, are there any drawbacks to learning C# under linux? If so, are there any good lessons online for doing such a thing? Any good tutorials online for learning C# in general?
update
so what I'm getting is that the main drawback is that although the full C# language spec is implemented in mono, the full .Net framework isn't. But, until I can get a new system and run windows, I guess lacking the full framework will have to do.
The language spec is fully implemented but the framework itself is not. So learning C# the language will be no different (ignoring the benefits of using visual studio as your IDE). Writing against the framework will be a bit different.
edit> It also depends on what kind of programming you intend to do. Much of the parts of mono that aren't complete are also often edge cases for beginners that you aren't likely to run into. So if you're just learning C#, there's a very good chance that you won't come across the parts of the framework that haven't been implemented yet (and I mean yet, they are very fast at updating mono from what I've seen so far, so by the time you're ready to really explore the framework and all that it entails, there's a good chance that it might be completed by then)
learning C# on linux may actually be good, when you start doing it on windows, you will know both. The IDE will not be as modern, but I'll bet there are not many people that can do it on both.
You'll be able to concentrate on the actual C# language and you can learn the microsoft IDE when you get to use C# on windows.
The major drawbacks that I see are:
The latest .NET versions are not supported
Different tools between Mono and Visual Studio
In spite of that, I think you can learn a lot about C# on Mono.
Any good tutorials online for learning C# in general?
Here's a tutorial I wrote:
http://www.csharp-station.com/Tutorial.aspx
Feedback has indicated that all of the code in the tutorial runs fine on Mono.
Joe
Learning the language should not hurt, I would not depend on it to land you a job. However, keep in mind that many of the runtime services that are accessed via C# may not be available. Knowledge of those services is perhaps just as, if not more, important the language itself.
The main problem with C# on Linux is that your development system will not be as good, in most people's estimation. But you may get really good at vi(1)...
On MonoDevelop you won't have all the newest features of the .NET framework, it's somewhere between 2.0 and 3.5.
It supports C#3.0 though.
Mono is gaining traction very, very quickly. I've heard rumblings that MS is silently supporting Mono (see their approach with getting SL to run on Linux). In some cases, mono actually outperforms .net on a windows based server.
The downside would be the IDE and features, as many have already mentioned. Visual Studio is by far the best IDE out there.
It does support Asp.Net MVC IIRC though.
Mono overcomes the single biggest drawback to using .NET from Microsoft for many developers, the requirement to run on the Windows platform. By bringing the shared source release of the .NET Framework to multiple platforms and then building an open source project around extending it, The Mono Project has made the strengths of .NET available to a wide range of developers. The ability to develop using a variety of languages, all using a common interface and deployable on a number of platforms is a very compelling development strategy.
As far as the web services aspects of Mono are concerned, nearly all of the Framework is complete meaning a developer can begin developing web services today using Mono. Mono features nearly complete implementations of ASP.NET, ADO.NET and Web Forms, along with almost all of the SYSTEM namespace. For more a detailed visit mono's official site,mono-project.com check out these articles on Cool Solutions for Developers:
Well there is nothing wrong if we learn something & probably we might end up improving it which will be more useful to the future users.Probably that is the power of open source.I think all developers will agree to this point :)

Is WPF on Linux (already) possible?

I love programming with .NET, especially C# 3.0, .NET 3.5 and WPF. But what I especially like is that with Mono .NET is really platform-independent.
Now I heard about the Olive Project in Mono. I couldn't find some kind of Beta.
Does it already work? Have any of you made any experiences with it?
Edit: I know about Moonlight. But I want a standalone WPF application. And because of Moonlight I hope WPF on Linux will become true.
You'll have better luck working with Moonlight, which targets the Silverlight API, which is a subset of full WPF.
edit: Sure, Silverlight isn't "intended" for the desktop, but there's no reason why you can't embed a silverlight engine in your application. It's been done before, such as for the Mac NY Times Reader
more edit: see Miguel's post on Standalone Silverlight Applications
Update: Since people keep upvoting this, I want to point out it is long since out of date. Mono got acquired by MS years ago, and their posture regarding open-source has changed, so consider this post obsolete. (As obsolete as the WPF framework itself, heh).
Mono is in a bit of an uncomfortable position when it comes to Microsoft APIs such as Winforms and WPF. A subset of the .Net technology is an ECMA standard, but free implementations of these APIs are probably on shakier legal ground. I believe this was a large factor in the covenant between Novell and Microsoft, which is good for Novell customers. But people who use Mono that aren't customers of Novell aren't protected. For this reason a lot of people in the F/OSS community look askance at Mono despite its technical merits.
For this reason, Gtk# will always be preferred, since it is truly Free. Many people consider it to be superior to Winforms anyway. As far as WPF is concerned, it will almost certainly be a low priority for Novell. They may implement it eventually, but I would expect Moonlight to be the closest you could get for the forseeable future.
Since posting this, Microsoft has extended their covenant to anybody who implements the ECMA 334 & 335 standards.
From the mono website
At this point, the Mono project does
not have plans to implement Windows
Presentation Foundation APIs as
part of the project.
Moonlight is an implementation of silverlight, which is a browser based flash like technology based on a subset of WPF.
In my opinion the choice to not implement WPF is monos biggest mistake. As WPF is fast becoming the default choice for new .net user interfaces. See this blog for more.
There is a library called Silverform SDK that aims to provide cross-platform WPF and Silverlight implementation.
The library is implemented in managed code and currently works with OpenTK and Unity3D as render backends. Major functionality, such as binding, layout, main controls and primitives, has already been implemented (check Unity web player demos here). Initially it has been focused on Unity3d render, while support for standalone Mono applications will be added as a separate build in the future.
Disclaimer: I am one of the developers of the library.
If you check Known bugs of this link(also includes steps needed to install .NET onto Ubuntu)or this you may find that some(may be buggy) version of WPF works on Wine as for now. I did not find any definite test done as for now, but worth to try to run WPF "Hello world".
UPDATE2:
I have run latest IlSpy on latest Wine for Ubuntu 16.04. With 32 bit version of dotnet45 and corefonts installed via winetricks with windows 7 compatibility.
For this time no crashes and all things work fine. Fonts look really good.
IlSpy is shown via WPF and for person who loves programming with .NET is essential tool - the decompiler.
I downloaded latest portable SharpDevelop(build using WPF) with no extra. It started. Failed to create WPF project. Created WinForms. After opening some cs files and evidencing some glitches, tried to type - and it crashed.
UPDATE
I followed steps and got latest ILSpy.exe running on Ubuntu 14.4.
Next items to note:
wine stated that dotnet40 is not supported by 64 configuration, changed to 32 bit
fonts are ugly, but readable
basic functional works fine - I can see decompiled code - which is good enough for some development, but View -> Search and View -> Options -> Display crash.
Conclusion:
WPF on Linux is possible. But need some way to tackle issues.
From the Olive home page:
Olive is unsupported, should be
considered as experimental software,
and since it implements a shifting API
there are no guarantees of any kind
about the stability of the API.
I doubt anyone would have used it in a real project.
Yes, it is possible using NoesisGUI a real-time multi-platform XAML implementation. There are a few games already released using this technology in Linux, like VoidExpanse
Disclosure: I am one of the developers of this product.
I heard a podcast interviewing miguel de icaza (the mono lead) maybe a few weeks ago, so that would have been maybe mid-december 2008, and he said that they had no WPF support at all yet.
Theoretically, a stripped version of WPF COULD be compiled against WinPR or LibWine to run on Linux.
Currently there is no such setup, so someone would need to make one. Hopefully this might change soon.
As of running against or in a full Wine environment, I think that is seriously overkill and will result in too much bloat to be worth making a very small number of additional programs work.

Categories

Resources