Mono 4.2.1 Release Notes
- More adoption of Microsoft’s open source code
- this causes a small PasswordDeriveBytes compatibility breaking change, see below
- Support for PPDB debugging format
- New threadpool implementation
- Runtime optimizations
- Extensive bug fixing
Portable PDB files
Mono’s runtime can now consume debug information encoded in the new Portable PDB file format.
The Portable PDB (Program Database, or PPDB) format describes an encoding of debugging information produced by compilers of Common Language Infrastructure (CLI) languages and consumed by debuggers and other tools. And most importantly, it is fully documented.
At the same time, newer versions of Microsoft’s Roslyn compilers are now able to produce PPDB files so it is now possible to use Roslyn compilers and have the Mono runtime use their debug information.
The PPDB format is under active development, while Mono currently implements support for the latest edition of the format, it is possible that the format might still change.
Layout Changes for Nested Structures
Nested structs used to be aligned to
sizeof (void *) so
they looked blitable, but didn’t match their native layout.
This caused all sort of issues when doing interop.
We now align them following ABI rules, which should fix a lot of issues.
This is a breaking change to those already native interop and relying on the wrong layout calculations done by the runtime.
Delegate Internals Updated
Change how delegates work internally from using a reverse linked-list to an array.
This will be faster and allow us to enable the fast vcall thunk for delegate invoke.
Static Compilation (FullAOT)
We now collapse enum to primitives and ref types to object and share based on that.
So for example a
KVP<EnumA, string> will share the implementation
KVP <int, Type>
Stacktraces on re-throws
We have changed the stack trace behavior on rethrows.
This is a merge of https://github.com/mono/mono/pull/1668
Most commonly, an exception is thrown immediately after it is constructed and processed without being saved. It is possible to catch exceptions, save them to variables, and throw them again at a later time.
When this type of exception is caught in .NET, the StackTrace on the exception object refers to the location where the exception was last thrown from. In Mono, we were giving it the location that the exception was first thrown from. This fix makes Mono more closely behave like .NET.
ProcessInfo.Module returns the list of loaded modules, we now are
able to return the address of any of the assemblies loaded with
mmap(), previously this functionality was not available.
We have replaced Mono’s implementation of the ThreadPool with Microsoft’s implementation. It has many interesting properties in terms of how threads are started up and terminated, which was too aggressive previously.
The new code is also simpler to maintain.
Added ARM HFA support
The runtime now supports the HFA calling convention on ARM architectures.
We have extended the use of SafeFileHandle in the stack, in addition to file handles, we now use it for socket handles.
Concurrent Sweep in the GC
The purpose of this is to reduce pause times of major collections by making sweep completely concurrent.
The first phase of sweeping is iterating through the block list, freeing blocks without live objects, and designating the others for lazy sweeping. This phase happened while the world was stopped. This makes it concurrent. The changes include the introduction of a very simple thread pool abstraction (currently supporting only a single thread) that unifies concurrent marking, jobs when scanning roots, and concurrent sweeping.
Read more details and charts
Dropped support for external Boehm libgc
The Mono runtime is no longer able to use an externally compiled Boehm
Support for Direct internal calls
The Mono runtime can now perform direct calls to internal calls from managed code, without requiring icall wrappers.
The Mono runtime no longer raises exceptions directly, but instead uses the
mono_set_pending_exception which allows us to remove the overhead of calling an
internal call. This improved performance is mostly visible with runtime intrinsics
that are invoked by the generated managed code, and shows up in particular in
New thread suspend machinery
We reworked suspend code to be based on a state machine and eliminate known races in the process.
This release contains major upgrades to the profiler infrastructure to support tools like the Xamarin Profiler whose UI required more information than we were previously providing, or to make it simpler and faster for the profiler to consume and process the data.
Microsoft Source Code Adoption
This is the second release of Mono that replaces various components of Mono with code that was released by Microsoft under the MIT license in one of three places:
- Microsoft’s ReferenceSource drop
- Microsoft’s CoreFX
- Microsoft’s CoreCLR
While Microsoft is working towards .NET Core: a redistributable and re-imagined version of .NET, the project remains a work in progress. Mono at this point continues to provide an API that tracks the .NET desktop/server version.
This means that most of the code that we have integrated comes from the ReferenceSource drop. In the future, we will deliver a “Mono Core” along the same lines of .NET Core to allow the use of the Mono runtime with the new library distribution system that is being developed with CoreFX.
In this release, we have either ported components that were either incomplete or buggy in Mono and were relatively easy to port to Mono. There is much more to be done in this area. If you are interested in tracking those efforts, check the project status.
Mono ships now with a subset of the referencesource that have been adjusted to work with Mono’s class libraries or have been updated to be cross platform.
Changes made to Microsoft’s reference source code are published under Mono’s github organization fork at https://github.com/mono/referencesource
The following components in the
System assembly were replaced with
Microsoft’s implementation, with some small changes to make the code
portable to Unix:
- Parts of
System.Diagnostics(excluding the components that are tied with the Mono runtime)
- Small parts of
- Parts of
System.Net(HTTP Cookie handling)
Around 500 .NET types were replaced with the Microsoft implementation, with small changes made to make Microsoft’s code portable.
Some themes in this release include:
- Replacing some of the key types in the
- Continued our work to replace large chunks of the globalization stack in Mono with Microsoft’s implementation
- Portable parts of
- Large parts of
System.Reflection, those that do not depend on Mono runtime internals.
- Large parts of
- The portable parts of
- The portable parts of
- Most of
- Most of
- The threadpool
- Most of SafeHandles
System.Security.Cryptography contains a compatibility breaking change in 4.2; the
PasswordDeriveBytes class behaves differently.
PasswordDeriveBytes contains a nonstandard extension of the PBKDF1 algorithm. The extension determines what happens when bytes are requested beyond the hash length, normally not possible with PBKDF1. Before 4.2, Mono used its own custom extension which was incompatible with Microsoft’s extension. Starting with 4.2 Mono uses Microsoft’s version, which unfortunately means 4.2 is incompatible with 4.0.
If your application requires consistent behavior from
PasswordDeriveBytes (for example, if you are using it to generate a decryption key), here is what you should do to ensure compatibility when using Mono 4.2:
- If you extract no more bytes than the hash length (for SHA-1, the default, this is 20 bytes) from
PasswordDeriveBytes, the behavior will be identical between all versions of Mono and Microsoft .NET.
- If you need compatibility with applications targeting Microsoft .NET, use the
- If you need compatibility with applications targeting Mono 4.0 or previous, you can download mono-old-passwordderivebytes-188.8.131.52.zip, which contains source for a Mono 4.0-compliant version of
For new development, we recommend avoiding
PasswordDeriveBytes entirely and using
Rfc2898DeriveBytes, which is standard-compliant (PBKDF2), more secure, and does not have the compatibility issue.
The types from
System.Linq in the
System.Core assembly have now been
completely replaced with Microsoft’s implementation.
The cross-platform parts of
System.Data have been replaced with
Microsoft’s implementation of
System.Data.SqlClient API which implements the connectivity to
SQL server continues to be Mono’s implementation, as Microsoft’s
implementation is too tied up to Windows specific code.
While we had an implementation of
System.Data.OleDb in the past,
which depended on Gnome’s GDA library, it has not been operational in
many years, so we have removed the implementation, and added in its
place a Windows specific version from Microsoft (that means, we do not
have a cross platform OleDb, but we did not have a working one to
Switched most of this assembly to the Reference Source code. We have made a few changes that allow this assembly to be used with systems that do not allow dynamic code generation (iOS, PlayStation and Xbox)
System.Xml and System.Xml.Linq assemblies
We have replaced Mono’s System.XML implementation with Microsoft’s version.
For systems that do not allow dynamic code generation (iOS,
PlayStation, Xbox), the
XmlSerializer continues to be Mono’s old XmlSerializer.
Replaced Assemblies with Microsoft code
The following assemblies are now mostly based on Microsoft’s ReferenceSource code, with small changes to make them cross platform, or otherwise be integrated into Mono’s build system:
New tool that is a tool that converts a stack trace with
into one with file names and line numbers.
mdoc command has been updated to better match generic arguments
when updating your existing documentation.
We no longer ship all of Lucene.Net, instead we only ship the parts that MonoDoc actually uses.
Now takes a
--dos2unix[=false] parameter which controls whether
mkbundle should use the
dos2unix command on the resulting output.
The Mono linker adds support for PCL type forwarders, making the linker PCL friendly.
The linker also now supports descriptor files embedded into assemblies being linked. This allows developers to embed linker description files that can instruct the linker how to link an assembly without requiring the end user to know about the internals of an assembly.
Adds support for linking security declarations.
It also fixes support for generics and linking and improves the linker performance.
The tool now has a silent mode
- Now uses CSS for coloring API diffs, instead of old school HTML.
- It now ignores non-important attribute differences
- Properly colorize removed types (as red).
- Print ‘NotSerialized’ field attribute change (as not breaking).
- Ignore ‘HasSecurity’ and ‘PInvokeImpl’ method attribute differences.
- Render property indexers (and detect name change in property indexer parameters).
- Improve debug spew to print proper method/field attributes.
- Renders generic parameter constraints
Implement support for many undocumented features in
Improves the Visual Basic compiler support (requires Roslyn based compiler, available separately).
- #32886 - Xamarin-product private bug
- #33066 - Watch evaluations different in XS than VS
- #32918 - StackTrace() missing original exception - ExceptionDispatchInfo
- #32931 - Xamarin-product private bug
- #33080 - Xamarin-product private bug
- #32579 - System.Diagnostics.Process.MainModule.FileName does not return full path of the executable and returns 15 chars trimmed value which is same as Process.ProcessName
- #32539 - Process.ProcessName value fetched using Process.GetProcesses () is trimmed to 15 characters
- #32947 - App just hangs on iOS9 device with iOS9 SDK
- #32815 - PropertyInfo.Module throws System.NotImplementedException
- #32832 - C#6 string interpolation with dictionary initializer fails to compile
- #31877 - SendChunked - "Method must be implemented"
- #32732 - Xamarin-product private bug
- #32712 - Incorrect compile error CS4016 when for async function that returns Task<Task>
- #32179 - Consistent crash in mini-arm.c when running FSharp on Raspberry Pi 2
- #32685 - NRE in ServicePoint.CheckAvaliableForRecycling
- #32561 - Could not load file or assembly Microsoft.Build.Utilities
- #31830 - Xamarin-product private bug
- #27864 - [iOS 8.2] SQLite.net queries fail in iOS 8.2 if they contain UNION or COLLATE
- #32456 - Expression-bodied properties cause issues in conjunction with XML comments
- #32060 - Internal compiler error
- #31932 - Regression: Stack Overflow with native P/Invoke Callback
- #32137 - System.Text.Encoding.UTF8.EncodingName not the returning human-readable description of the current encoding
- #31948 - Mono C# compiler incorrectly emits CS0647 for attributes on method parameters
- #32135 - C# 6 string interpolation and lambdas miscompilation
- #32130 - Parenthesis around elvis operators do not resolve to nullable
- #32054 - Internal compiler error using Null Coalescing Operator on System.Nullable
- #10268 - Linker issue with horizontallistview project in release mode
- #27620 - Xamarin-product private bug
- #31921 - Xamarin-product private bug
- #31451 - mono_trace_set_printerr_handler calls g_set_print_handler instead of g_set_printerr_handler
- #31784 - Xamarin-product private bug
- #31829 - Xamarin-product private bug
- #30023 - Using default constructor in watch window does not work
- #31635 - UnixMarshal.PtrToString fails with UTF32Encoding
- #31582 - iOS -O=float32 fails for some operations on ARM7
- #31199 - Seeing ‘Data unprotection failed.’ when attempting to run ‘mono NuGet.exe restore’
- #30698 - Build fails when building for device using –aot-options=-O=float32 and performing a calculation on float or nfloat variables
- #31396 - Stack overflow while mono loads roslyn CSharpSyntaxGenerator.exe
- #30488 - [XI 8.10.1] "Error setting up QueryLanguage class vtable" during AOT of Rx-Linq assembly, related to the linker removing certain methods from the QueryLanguage class
- #31507 - ObjectDisposedException when canceling postAsync
- #30904 - Compiler crash with Mono 4.0.1 under Ubuntu 14.04
- #31398 - Cultures zh-Hans and zh-CHS are equal when they should not be
- #31336 - HttpClient adds comma in User-Agent
- #31369 - CodeDom can’t compile code on El Capitan
- #31289 - Xamarin-product private bug
- #31231 - Crash with generics makeref
- #30825 - Null string to mono_mmap_open_handle Regression between 184.108.40.2068 and 220.127.116.11
- #30880 - IPv4Mask property produces a Not Implemented Exception
- #31092 - compiler crashed with code: 1
- #30973 - Incorrect CS0425 when generic base class implements non-generic interface method
- #30851 - Incorrect (Swedish) date format since version 3.4.0
- #30741 - MemoryMappedFiles from reference source is causing segfaults
- #31020 - Order of interfaces in GetInterfaces() is random
- #31060 - F# sprintf AOT bug happens still now.
- #30604 - HttpClient times out when redirected on a Post request
- #30869 - HttpClient authentication not working
- #30897 - App crashes with Thai locale selected
- #30448 - Cecil loads referenced assemblies from GAC specific to the running application, not the referencing library
- #30868 - ObjectDisposedException in mono 18.104.22.168, but not mono 3.12.1
- #21520 - mono build is broken because of test-conc-hashtable failing to link
- #30360 - Error in handling of /etc/localtime file to retrieve time zone on Linux
- #30679 - Error: Compiler crashed with code: 1.
- #30617 - Stepping over foreach exits method
- #29491 - Xamarin-product private bug
- #30695 - Invalid syntax (using ?.) crashes smcs
- #30587 - Xamarin-product private bug
- #27103 - mono-service segfault reflection.c:7477
- #30043 - Disposing a FileSystemWatcher object causes ArgumentOutOfRangeException
- #30472 - Xamarin-product private bug
- #29927 - Http Response doesn’t UnescapeDataString
- #30551 - Potential race in do_rehash
- #30529 - Xamarin-product private bug
- #30469 - String interpolation with escaped bracket generates wrong result
- #30478 - Inner finally block not called
- #30502 - AssemblyName.CultureName implementation differs from .NET.
- #30507 - Xamarin-product private bug
- #29928 - Problems with encodings
- #30204 - Xamarin-product private bug
- #28187 - Calling System.Environment.Exit() leads to SIGABRT: Assertion at mini-exceptions.c:834, condition `domain’ not met
- #29726 - NSTimer stops if tick handler processing takes long time but only in 32-bit ARMv7 code
- #29906 - Static method TimeZoneInfo.GetSystemTimeZones() is not thread safe.
- #30349 - Xamarin-product private bug
- #30267 - Constant value ‘invalid decimal constant’ cannot be converted to a ‘double’
- #28793 - SynchronizationContext.SetSynchronizationContext leaks back inappropriately into caller
- #30060 - Xamarin-product private bug
- #30276 - Xamarin-product private bug
- #19697 - WCF SendTimeout not working in Xamarin
- #23792 - SOAP response incorrectly truncated at chunk boundary on Android using httpClient to send SOAP over SSL
- #30205 - Xamarin-product private bug
- #30171 - BinaryReader.ReadChar() returns incorrect result on 8.10
- #24968 - All characters are allowed as Unicode escape sequences within identifiers
- #28398 - * Assertion: should not be reached at class.c:6405
- #30099 - Xamarin-product private bug
- #3811 - DataContractJsonSerializer deserialization fails with subclass of List<int> as known type
- #29970 - [MonoNativeFunctionWrapper] doesn’t work with methods that return structures on 32bit device
- #29615 - Bug during linking
- #1856 - Wrong stack trace when exception is re-thrown
- #29538 - Xamarin-product private bug
- #29667 - Mono v4.0 crashes after a while
- #29808 - Xamarin-product private bug
- #29823 - 4.0 Regression - SqlConnectionBuilder broken after migrating to System.Data reference source
- #29276 - Use of possibly unassigned field for sub struct on out parameter
- #29665 - [Regression] System.InvalidProgramException: Invalid IL code
- #29459 - Could not load file or assembly ‘System.ServiceModel’ or one of its dependencies. The system cannot find the file specified.
- #29506 - invalid IL generated for async method
- #29691 - Compiler error for read-only auto-properties with certain names
- #29177 - Mono-hosted OWIN server crashes under load.
- #29078 - Commit f763a006329a4a04aac7ea7a4fa03cad18b20193 has broken application
- #28918 - MTOUCH: error MT0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
- #29211 - [XI 8.10] Enabling linker with Profile 7 PCL that uses System.IO.Compression causes "Could not load file or assembly ‘System.IO.Compression’" at runtime
- #20048 - Socket ctor missing
- #29183 - Array constructor fails to construct multi bound array
- #25717 - Calling a created delegate for value type fails in Mono but works in Windows
- #28069 - Compiler Crash, async, not existing variable
- #28692 - GetCustomAttributes seems to return attributes in a different order than in windows.
- #28876 - Satellite assembly finder fails for memory-loaded assemblies with GetDirectoryName(): Invalid path
- #28209 - Xamarin-product private bug
- #29044 - "using static" not consulted for nested type
- #29039 - CultureInfo.GetCultures(CultureTypes.SpecificCultures) returns broken ar-SA culture
- #24647 - ExceptionDispatchInfo::Throw does not replace capture stack trace
- #28976 - "using static" not consulted for libraries
- #28747 - Xamarin-product private bug
- #28823 - strange behaviour causing loaded classes to appear unloaded when referenced from class attributes and using nay kind of linking.
- #28961 - AOT error when upgrading to Unified API
- #28557 - Xamarin-product private bug
- #28857 - Nursery-canaries and AOT causes assertion failure
- #26362 - [Process] Exited event raised while process still running
- #28369 - mono runtime crash "assertion ‘hash != NULL’ failed"
- #28847 - Xamarin-product private bug
- #17817 - Convert.ToUInt64 with base 10 does not check range
- #28777 - GZipStream (DeflateStreamNative) native exception after Flush() with no buffer data: Internal error (no progress possible) Flush
- #28837 - Problems determining overloading candidate
- #28774 - mcs crashes with stack overflow when compiling class with Lazy<T> and stackalloc byte
- #28772 - New auto-implemented property error with the first C# 6.0 alpha update.
- #28014 - Type is not serializable with a type-forwarded SerializableAttribute
- #28022 - Mono C# compiler incorrectly emits error CS0053 when using protected internal members in a derived class that is nested inside another class
- #28211 - Getting "error MT3001: Could not AOT the assembly" When Building for Device
- #28617 - Linker-modified System.Net.Http.Primitives.dll causes ArgumentOutOfRangeException during mono-cil-strip
- #28653 - Invalid CS0311 error for overloaded generic method with dynamic parameter
- #28648 - Invalid CS0118 error when a custom namespace called "var" is declared and var used in code
- #28645 - Invalid CS1908 error for dynamic parameter with DefaultParameterValue attribute
- #24086 - Runtime test - TestDaylightSavingsTime fails against Asia/Amman for 2012 DateTimes
- #28172 - 3.12.1.
- #28651 - Invalid CS1501 error for overload with optional parameter in interface
- #17615 - Unexpected parsing with Lithuanian culture
- #28611 - Xamarin-product private bug
- #28201 - Mono C# compiler incorrectly emits CS0229 when referencing from a DLL a property in an interface that hides a method from an interface that it is derived from.
- #28196 - FlowAnalysis issue with out parameter and finally and delegate containing a return
- #26109 - Xamarin-product private bug
- #28435 - Xamarin-product private bug
- #28296 - mcs incorrectly reports CS0188: The `this’ object cannot be used before all of its fields are assigned
- #28213 - Xamarin Studio on OSX fails to compile where Visual Studio 2013 succeeds
- #26936 - Xamarin-product private bug
- #28292 - Internal compiler error when an interpolated string is too long
- #28293 - Unexpected symbol error when two interpolated strings are used with the ternary operator
- #28383 - Marshal.AllocCoTaskMem(0) incorrectly returns null
- #27667 - Xamarin-product private bug
- #28311 - Xamarin-product private bug
- #28331 - Custom Attributes incompatability
- #28290 - Marshal.AllocCoTaskMem does not throw OutOfMemoryException on alloc failure
- #28235 - System.Type change to reference source broke IronPython
- #27787 - Xamarin-product private bug
- #28181 - * Assertion: should not be reached at debugger-agent.c:5957
- #28184 - ParameterInfo.GetCustomAttributes returns null in some cases
- #28098 - After running a mono process the shell no longer shows input chars
- #19823 - InvalidOperationException in ServicePoint.RemoveConnectionGroup
- #27725 - Missing day names in ar-EG culture
- #18171 - [System.Xml.Linq, System.Runtime.Serialization] XElement implements IXmlSerializable, but lacks parameterless constructor, and has incorrect QName in KnownTypeCollection
- #14856 - XmlDocument.Load() throws Exception if XmlResolver is set to null
- #2917 - XslCompiledTransform.Load ignoring xsl:output properties
- #27597 - csharp REPL on Windows doesn’t accept any input
- #26363 - [Process] StartTime is unset for all Processes returned by Process.GetProcesses
- #27982 - Inconsistent behavior in DynamicAttribute.Equals() method
- #26858 - HttpListener’s scheme parser is case sensitive
- #27737 - Xamarin-product private bug
- #27565 - Xamarin-product private bug
- #26989 - Xamarin-product private bug
- #27147 - Xamarin-product private bug
- #25254 - Xamarin-product private bug
- #26998 - Issue with DataContractJsonSerializer - Deserialize type incorrect on iOS
- #25559 - Memory leak in Microsoft.Win32.Registry.toKey()
- #27697 - Debugger crash: error: * Assertion at ../../../../../mono/mono/mini/debugger-agent.c:2475, condition `tls’ not met
- #27614 - Native interop: out LPArrays cause crash
- #27707 - Xamarin-product private bug
- #20764 - WebMessageFormatter crashes with void return type OperationContract
- #27258 - Two build problems on s390x
- #27533 - C#6 interpolated string raises Internal compiler error during parsingSystem during compilation
- #27525 - C#6 interpolated string raises NotImplementedException: CloneTo during compilation
- #27441 - Better compiler error message for unexpected symbol/unexpected character.
- #27492 - Build error in reference sources for System.ComponentModel namespace
- #27269 - Xamarin-product private bug
- #19334 - BeginWrite failure at System.Net.Sockets.NetworkStream.BeginWrite
- #27386 - HttpClient doesn’t honor BaseAddress with the Get*Async methods
- #27338 - Xamarin-product private bug
- #27352 - HttpRequestMessage: adding Accept header with multiple values fails
- #16475 - Method not found: ‘System.Web.Routing.RouteCollection.get_AppendTrailingSlash’
- #21810 - Method not implemented: ‘System.Web.HttpApplication.RegisterModule’
- #35301 - Difference in behavior of
We want to thanks all the contributors that helped make this release.
In addition to the anonymous developers at Microsoft, code from the following individuals is included in this release:
Dean Ellis, Alex Rønne Petersen, Radek Doulik, Aaron Hoffman, Alan McGovern, Alex Soto, Alexander Kyte, Alexander Köplinger, Alexis Christoforides, Ankit Jain, Atsushi Eno, Bill Seurer, Bojan Rajkovic, Brian Luczkiewicz, Chad Dettmering, Chris Hamons, Craig S. Bosma, Damien Diederen, Dave Curylo, David Moore, Eberhard Beilharz, Gabriel Garcia, Geoffrey Huntley, Greg Young, HellBrick, Iain, James, Jan Beich, Jb Evain, Jo Shields, Joel Martinez, Jon Purdy, Jonathan Braswell, Jonathan Pryor, Joao Matos, Kai Ruhnau, Khoa Nguyen, Leonid Shalupov, Lluis Sanchez, Ludovic Henry, Marc Kohaupt, Marcin Cieslak, Marcos Henrich, Marek Habersack, Marek Safar, Marius Ungureanu, Mark Probst, Martin Baulig, Martin Potter, Matthias Bogad, Matthias Mailänder, Miguel de Icaza, Mort Yao, Neale Ferguson, Ole A. Sjo Fasting, Ondřej Hošek, Radek Doulik, Rodrigo Kumpera, Rolf Bjarne Kvinge, Romain Tartière, Sebastien Pouliot, Steffen Kieß, Stephen McConnel, Stone Gislason, Svetoslav, Svetoslav Karasev, Tom Philpot, Ungureanu Marius, Vincent Povirk, Vlad Brezae, Vlad Zaitsev, Vladimir Kargov, Yann E. MORIN, Zoltan Varga, anikilatorbeta, debugerr, iain holmes, jaredpar, jason_naylor, keneanung, martincostello, myrup, zevane