First Moonlight Release

by Miguel de Icaza

Today we are making the first public release of Moonlight, supporting the Silverlight 1.0 profile for Linux. The release comes in two forms:

  • No-media codecs supported, but easy to install: head to http://www.go-mono.com/moonlight and click on the cute installer for Moonlight. This currently hosts builds for Linux x86 and x86-64 for Firefox.
  • Source-code compilation, but you can optionally compile FFMpeg codecs yourself. To do this, download our moon-0.6.tar.bz2. And follow the build instructions.

Update: I apologize for the confussion; This is not Moonlight 1.0, this is the first source code release that we are making of Moonlight for interested contributors and developers. This release is not even a Beta release, as we are not yet feature complete (missing components in media codecs, the media pipeline, as well as fixing about 70 known bugs). Apologies for any confussion.

Although Moonlight works on Firefox 2 and Firefox 3, recent changes in Firefox 3 prevent Silverlight and Moonlight from working (For details see #432371, #430965). There is a user contributed Greasemonkey script that will work around this bug for some sites (requires Greasemonkey).

Windowless: Moonlight supports "windowless" mode, a mechanism that allows Silverlight content to blend with other HTML ements on a page. This is only supported by Firefox 3, users of older versions of Firefox might run into Silverlight applications and web sites that do not work correctly as many Silverlight applications depend on this functionality (Flash sites have the same problem with Firefox 2).

1.1 and 2.0 support: This release only supports the Silverlight 1.0 profile. The 1.1 support is no longer maintained and the release happened at the time when we are transitioning the APIs to 2.0.

If you find bugs, please file them for us to fix.

Posted on 13 May 2008


Mono's Winforms 2.0 is now API Complete

by Miguel de Icaza

Jonathan Pobst has posted the update on our Windows.Forms 2.0 work.

Some interesting points from his blog entry:

  • We are now API complete, which means that our public API is exactly the same as .Net's (all 12,776 methods).
  • The first check-in to our current Winforms implementation was on July 8th, 2004. It took 4 years to get here, and 6,434 individual SVN commits.
  • The toolkit is made up of 115k lines of code.

Also:

  • We currently have three backends: X11, OSX and Win32.
  • There is a Google Summer of Code effort to improve our theming and OS integration this summer.
  • Winforms 2.0 will also debut support for XIM to allow input for CJK character sets.
  • We have a nice binding to Gecko as our implementation for WebControl which we started last year (currently we are limited to Gecko on X11 though, no Mac support yet for this WebControl).
  • The Desktop team at Novell is adding UI Automation and accessibility support to Windows.Forms integrating it with Gnome's ATK. They have a full team dedicated to that goal.
  • R-to-L support: It is not an priority for us at this point, but it would be nice if someone with RtoL needs were to complete the work that Sebastien did last year to use Pango inside GDI+.

Winforms 2.0 was the last piece of code holding off the Mono 2.0 release. We anticipate that there will be bugs, so we want to encourage folks to submit their bug reports and to evaluate the portability of their sofwtare using our Mono Migration Analyzer tool.

Congratulations to the Winforms team, and everyone that provided bug reports, test cases, contributed code, tested and worked with us to bring it to where it is today.

Posted on 13 May 2008


Cross-platform, standalone Silverilght Applications

by Miguel de Icaza

Tamir Khason published an interesting approach at hosting standalone Silverlight applications.

His solution is a Windows.Forms application that hosts a Windows.Forms.WebControl and inside the WebControl he hosts Silverlight.

Unlike my proposal for standalone Silverlight Applications that is currently Moonlight-specific (and currently limited to Linux/X11) this approach works on Windows with .NET and with Linux using Mono and Moonlight:

Left side: .NET hosting WebControl and Silverlight on Windows; Right side: Mono hosting WebControl and Moonlight running on Linux.

In addition to hosting the WebControl for hosting Silverlight, a thread is running to dispatch http requests locally using HttpListener. HttpListener is an embeddable HTTP server that is part of the class libraries, and exposes a very limited API. You can host ASP.NET with HttpListener by doing the bindings by hand, or you could use our Mono.WebServer library (part of our XSP/mod_mono distribution) to allow your applications to have a fully hosted ASP.NET server.

Mono.WebServer is what iFolder uses to embed the ASP.NET server to expose SOAP-based WebServices to clients.

Of course, this currently does not work on MacOS X as we do have no implementation of WebControl for Windows.Forms on OSX, something that a contributor might want to look into.

You can get the source for the sample from Tamir's page.

Posted on 06 May 2008


Consulting Gig at Novell

by Miguel de Icaza

We are looking for consultants to work on a six to nine month project at Novell to write a prototype for a Visual Studio addin in C# or C++ that will connect Visual Studio and its debugging infrastructure to a remote Linux machine running Mono and the Mono Debugger.

If you are interested in working with us in this project, you must have good C# and C++ skills, experience with networking and protocol design, knowledge of COM and assembly language programming are pluses.

We are looking to bring two consultants for the duration of this project. If you are interested, please click this link and attach your resume, pointers to some existing projects of yours and so on.

Posted on 06 May 2008


Rodrigo Kumpera Completes the Mono Verifier

by Miguel de Icaza

Rodrigo Kumpera, one of our VM developers has completed the instruction verifier for Mono's virtual machine. This effort started in June of last year.

The verifier is a late addition to the Mono VM as it was not a priority to run untrusted code inside the virtual machine.

But as Mono user base grew, it became important to support this feature. Second Life needs this to run potentially malicious code that is uploaded by a user, and we need this to provide an execution sandbox when running Moonlight on the browser.

Rodrigo did this work in stages: the first stage was to add support for the 1.0 virtual machine opcodes. Once that was done, verificiation for the 2.0 generic instructions was added.

This is an important milestone in our support for Silverlight 2.0 support on Linux.

Congratulations to Rodrigo for his work!

Posted on 30 Apr 2008


Mono and the Google Summer of Code 2008

by Miguel de Icaza

This year Mono is participating again on the Google Summer of Code. A list of the applications that were accepted is available at Google's page.

This year the quality of the applications and the new ideas submitted (aside from those we proposed) was fantastic. They were too good, and it was very hard to select the final projects (we wanted to pick 33 of the 75 projects proposed, but there were only 15 slots available).

Posted on 28 Apr 2008


LinuxersForObama

by Miguel de Icaza

Linuxers, BSDers, FLOSSers, GNUers, OSSers, Mysqlers, Gnomers, KDErs, Monoers, Javaers, PHPers, I invite you to donate to Obama through the LinuxersForObama campaign hosted at My.BarackObama.com web site.

If you are a US citizen, or a legal immigrant (green card holder), you can contribute 10, 20, or perhaps 2,300 to the Obama campaign.

You can donate here http://my.barackobama.com/page/outreach/view/main/LinuxersForObama.

I called the campaign "LinuxersForObama" because its short. I know it should have been called "GNULinuxBSDApacheX11PythonPerlMySQLPostgressPerlRubyJavaRailsMonoForObama", but it was getting hard to type.

And if you are a Windowser or Mac()er, but you like how Linuxers stick it to the man, feel free to donate to my LinuxersForObama campaign.

In retrospect, I should have created one campaign per product, and use that to settle once and for all, which is the best FLOSS project.

Posted on 18 Apr 2008


Standalone Silverlight Applications

by Miguel de Icaza

Last year we created a framework to run Silverlight applications as native applications. At the time we called those applications moonlight desklets.

The desklets are Silverlight applications that run in standalone mode, with full access to the entire Mono API stack (as opposed to be limited to the .NET subset for the web) and that can optionally render without frames. This is a screenshot from three desklets running on Linux from last year:

Beyond hack-value, there are in my opinion many reasons why this is valuable. Powerful .NET programming model, powerful graphics and animation framework, reuse the same code base for Web and desktop development, and a sandboxed execution model.

Many people have asked us privately about this.

The Magical mopen Command

To run a standalone desklet, all you have to do run the mopen command, like this:

	$ mopen ruler
	

The above command will look for a directory called "ruler" listed in your PATH, and if the file default.xaml lives inside that directory, it will open that file up. This XAML file can in turn reference managed code.

We did this so applications could be deployed in directories, very much like they are deployed on MacOS. The rules are simple, applications should be self-contained, keep all their data relative to their executable base directory, the foundation for this started with our application deployment guidelines.

It also draws inspiration from the bundles from MacOS X and the `open' command there.

How does this work? Lets consider our enterprise pixel measuring tool, the Moonlight ruler, which is made up of two files:

  • default.xaml, the basic XAML container, it references the managed code in ruler.dll
  • ruler.cs contains the code to draw the ruler.

This is what it looks like when you run it:

Awesome Moonlight desktop ruler.

Details

At LugRadio Live this weekend in San Francisco I decided to turn my Mono talk into a Moonlight talk, and I discussed some of the things that we have been doing with Moonlight.

Let me start with this artist rendition of Moonlight's Core:

The orange pieces were built by the Mono/Moonlight team at Novell. The green pieces are provided by Microsoft (and only for use in the browser context, we will get back to this later) and the blue stuff is stuff that we consume from the community.

The Moonlight Core provides the high-level canvas, the XAML loading, the animation framework, timers, media streaming and demuxing and event dispatching. It also has very few dependencies, it uses Cairo to render graphics and interfaces with our media pipeline and needs codecs to do video (currently ffmpeg if you build from source, or Microsoft's when we release).

Our engine today has three frontends:

The most important one of course is the plugin front-end, the one that is embedded into Firefox and renders the Silverlight content.

The other front-end is a Gtk# widget, a simple Gtk+ host that embeds the Moonlight Core into a widget and allows developers to embed any kind of XAML content (including managed code) inside it. I did a demo of Banshee embedding a grid of video players at LugRadio.

This is a widget that can be used to spice up your application. If you feel that you need some bling for your application, some gratuitous animations and special effects, the GtkSilver widget can help you. Using it is trivial:

	using Gtk.Moonlight;

	[...]
	void SetupWidget ()
	{
		Application.Init ();
	
		GtkSilver surface = new GtkSilver ();

		surface.LoadFile ("MyAnimation.xaml");

	        
		Window w = new Window ("Demo");
		w.Add (surface);
		w.ShowAll ();
		Application.Run ();
	}
	

If you want to get a handle on specific objects, you can just use the FindName method on the surface's canvas:


	MediaElement handler = (MediaElement) surface.Canvas.FindName ("MyVideoPlayer");

	// Start playback.
	handler.Play ();
	

And the third interface is the fabulous mopen command that we previously described (which is conveniently implemented on top of GtkSilver; yes, we know, we are geniuses).

The Two Stacks

As you might suspect from reading about GtkSilver and the browser, the Moonlight managed stack (that is, the C#/.NET APIs) actually comes in two shapes:

  • Browser API: This is what people creating Silverlight applications are familiar with. Its a subset of .NET 3.5 and it has limitations as to what you can do: no local file system access and a sandbox that encapsulates all the actions of Silverlight applications.
  • Full API: We also offer the full API, this is our implementation of .NET 3.5 that has been augmented with the Silverlight APIs.

As you can guess, GtkSilver and the desklets today use the Full API; And our browser plugin uses the more limited Browser API and the security sandbox.

We will get back to this soon.

Adobe Air

Adobe AIR has a great experience for installing native applications on your system, and they are cross platform (Windows, Mac and Linux).

I found a cute twitter application built with it, and have been a happy user of it for a few weeks (see screenshot).

I have no idea how extensive the AIR APIs are, whether they are sandboxed or whether they provide full access to all the APIs like our Moonlight Full API provides, but you can build some cute desktop applications with it.

I like it.

Silverlight Desktop Apps

Part of the reason why our Desklets did not evolve much in the last year was because there were no controls for them. You could build your own, but that was a lot of work, and it was hard to share, and most importantly, everyone knew that Microsoft was going to ship controls for Silverlight.

Now that controls are part of Silverlight 2.0 and that most of the high-level controls have been open sourced and that they are incredibly powerful and great to skin it makes sense to think again about native desktop applications using Silverlight.

We as a team can certainly create a Linux-only platform for these controls, and live happily with mopen, but we would miss an opportunity of having something cross platform like AIR is.

Ideally, Microsoft would follow our direction and implement and distribute the same mopen functionality that we have for Windows and Mac. This would ensure maximum adoption of standalone Silverlight-applications.

In a less ideal world, we (the Mono/Moonlight community) could port Moonlight's mopen command to Windows and MacOS, but with none of the power of influence that Microsoft has.

Directions and Challenges

Michael Hutchinson has suggested that we should have an minstall tool in the same spirit of mopen. This tool would take care of installation on each platform, creating shortcuts, desktop links and using the right icon.

Moonlight currently runs on systems with Cairo, and requires Gtk+ for event processing. It might be interesting to get it running on Win32, OSX and others with the tiniest footprint possible (bundling Gtk+ for Windows and MacOS for native apps sound large).

Another alternative is to use Microsoft's Silverlight on Windows to implement `mopen' as opposed to porting Moonlight. Apparently its possible to instantiate it through COM in some form, but that would still leave OSX out.

The codecs that Microsoft will distribute for use with Moonlight are limited to use inside the browser. This will prevent Moonlight's standalone applications from playing back any vc-1, wmv, wma, mp3 content.

We could add OS-specific codecs; On Linux we could call into Fluendo's commercial codecs, on Windows and Mac use the system codecs.

But we could also standardize on free video and audio codecs for the desktop edition: add support for the free video and audio codecs (BBC's Dirac, which will become VC-2, Vorbis and Theora).

We are currently busy doing Moonlight 1.0, and then we will get busy doing 2.0. So we will not be able to spend time on any of these projects for quite some time, but these are projects that developers in the community could work on or companies interested in pushing Moonlight in that direction.

Discuss.

Posted on 17 Apr 2008


Mono C# compiler now also MIT X11 licensed

by Miguel de Icaza

I know, so exciting, a license.

We are dual-licensing under this uber-liberal license because:

We are changing the license to allow parts of the compiler to be reused as part of MonoDevelop, our LINQ class libraries and to embed it in ASP.NET.

In MonoDevelop: This will allow the compiler to be used to improve code-completion to support C# 3.0 as well as improving the heuristics when offering completions. This will reuse the front end and parts of the backend.

Compiler hosting inside ASP.NET: This will embed the whole compiler into the ASP.NET process, eliminating about one second for each compilation of a piece of code. In the past, for each request for an uncompiled resource, we would have to call the compiler, wait for its output and then load the output. This typically shaves between 0.7 to 1 second on those scenarios, ideal to improve the developer experience.

LINQ Class Libraries: This will allow us to reuse parts of the compiler in our System.Core implementation for LINQ for the current 3.5 generation and upcoming generations. Many corner cases are handled by the compiler, and we will now be able to lift those pieces. This will mostly use the backend of the compiler.

Posted on 16 Apr 2008


Detailed InvalidCastException Goodness Comes to a VM Near You.

by Miguel de Icaza

When you perform an invalid cast in Mono (trying to force one type into another with a cast) or JIT would throw an InvalidCastException. If you are lucky, you would get a line number (compile with -g, run with --debug), but if you had a complicated expression you would have no idea what the problem was.

A few weeks ago, in support of Marek's growing pains in tracking down some bugs, Zoltan checked in support for a new feature in the Mono runtime: --debug=casts. Now, When you pass this option to the runtime, it will report the type that you are trying to cast. This feature is not activated by default as it generates more code, and consumes more memory.

This sample:

	$ cat demo.cs
        class Test {
                static void Main ()
                {
                        string s = "hola";
                        object j = s;

                        object d = (Test) j;
                }
        }
	$ mono demo.exe

	Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type.
	   at Test.Main () [0x00000] 

	$ mono --debug=casts demo.exe

	Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'Test'.
	  at Test.Main () [0x00008] in /tmp/demo.cs:10 
	

Awesome.

Posted on 16 Apr 2008


« Newer entries | Older entries »