Mono 5.16.0 Release Notes

Release date: 08 Oct 2018

Highlights

In Depth

Runtime

LLVM

A new option llvmopts has been added to allow override the built-in set of flags passed to the LLVM optimizer.

Response files support

A response file is a plain-text file that contains strings to be treated as arguments for mono runtime. You can now use a new option --response=FILE to pass the file with arguments in and they will be treated as if the user had instead entered the arguments individually.

Assembly loader

The loading of mixed strong named and non-strong names assemblies has been improved to further match .NET desktop behaviour. At the same time, we have introduces a new separation of loader contexts which can influence the loader behaviour. The context could be seen when using Mono debug options and we recognize 4 distinguish contexts.

  • default - Assembly.Load API
  • reflection only - Assembly.ReflectionOnlyLoad and Assembly.ReflectionOnlyLoadFrom APIs
  • load from - Assembly.LoadFrom API
  • individual - Assembly.LoadFile API

Hybrid suspend

Hybrid suspend is a new mechanism that Mono’s garbage collector may use to pause threads when during garbage collection. Threads that are running managed code or code that is part of the managed runtime periodically reach safepoints that indicate to the GC that it is allowed to suspend the thread. When threads are running P/Invokes or other native code outside of Mono’s control, the threads are suspended preemptively. Hybrid suspend brings some of the benefits of cooperative GC without requiring changes to embedder native code.

In 5.16, hybrid suspend is turned on by default on Linux (amd64 and i386) and macOS. There are configure flags and environment variables available to control the suspend mechanism:

  • Pass --enable-hybrid-suspend to configure to turn on hybrid suspend by default. Pass --disable-hybrid-suspend --disable-cooperative-suspend to use the old preemptive suspend as the default mechanism.
  • At runtime set the environment variable MONO_THREADS_SUSPEND to preemptive to use preemptive suspend or hybrid to use hybrid suspend.

32-bit floating operations

Performing 32-bit floating operations using 32-bit math is now the default settings for the runtime. Previously you had to manually enable the setting by using -O=float32 option.

Copy file on macOS

We have rewritten file copy operations on macOS to use special native API for file copying. This can significantly speed up large files operations on Apple File System (APFS) and has positive impact on non-APFS file systems as well.

The debugger library

The runtime can be configured using --enable-minimal=soft_debug option and the debugger code will be compiled into a separate libmono-dbg.a library. The library needs to be linked into the app if needed.

Custom modifiers enhancements

The custom modifiers are not broadly used feature of IL but getting more exposure in the latest C# compilers. We have fixed a few issues in handling them especially around type equality with custom modifiers.

Class Libraries

Optimizations

The underlying implementation of Span<T> and ReadOnlySpan<T> APIs was converted from portable IL implementation to intrinsics optimized version to fine-tune the implementation.

Additionally, special de-virtualization paths were introduced to speed up the execution of some EqualityComparer<T>.Equals and Enum.HasFlags calls.

CoreFX convergence

The effort to replace more BCL code advanced further by fully replacing System.Xml.Linq, System.Json, System.Threading.Tasks.Dataflow, System.ServiceModel.Syndication assemblies as well as some of the large namespaces in core assemblies including System.Net.Mail, System.ComponentModel, System.Text.Encoding.

Client certificate support

We now support client certificates for authentication as well as making requests to web servers that use TLS renegotiation.

The TLS renegotiation on macOS requires version 10.12 or newer.

System.MathF type

The single-precision math operations are now available in a new System.MathF class. Together with the -O=float32 option, this can be used to noticeably improve the performance in floating point intensive source code.

Prettier exception stack-traces

Ben Adams has contributed prettier exception printer, especially for generated code stack traces. For example, the async exceptions are now automatically de-mangled and instead of showing

System.ApplicationException: Error in the application.
  at X+<Foo>d__1.MoveNext () [0x0006c] in /path/foo.cs:14 <---

the stack trace shows the C# code signature

System.ApplicationException: Error in the application.
  at X.Foo () [0x0006c] in /path/foo.cs:14 <---

Mono.Options

The arbitrary command nesting is now supported. The two new mechanisms were introduced to allow that. The command names may now contain spaces and CommandSets may be nested within CommandSets. This allows supporting syntax like:

$ azure config mode arm
...
$ azure vm create
...

Automatic proxy configuration

The automatic proxy configuration has been updated to work correctly with newer macOS versions such as 10.13.

System.Drawing

Image loading routines have been hardened to have thorough checks for out of range inputs for various codecs.

Tools

C# compiler

The Roslyn compiler (csc) has been updated to version 2.8.2 which includes C# 7.3 support. The full list of language features is documented here.

The Mono C# compiler (mcs) supported features were extended to support additional C# 7.x features:

  • conditional ref expression
  • stackalloc span conversion in conditional expression
  • digits separators

MSBuild

MSBuild support has been updated to match the Visual Studio 2017 version 15.8 version.

sn

The sn tool, the utility for signing assemblies, has been updated to support signing PE32+ assemblies.

mkbundle

mkbundle has been extended to allow further customization of Mono runtime initialization sequence. It can be now controlled by setting BundleMonoAPI which contains the pointers to various Mono API functions used by the generated code. This mechanism is intended to be used by third parties which embed the Mono runtime and dynamically load and initialize it as part of the application startup, in which case the Mono APIs is not available for the shared library loader.

The --mono-api-struct-path parameter can be used to specify a file that is injected into the generated code, replacing the default structure definition.

nuget

The nuget tool has been updated to the latest 4.8 version (4.8.2).

Resolved Issues

  • #10000 - Type.IsSubclassOf Performance Regression
  • #10143 - Process.GetProcessesByName Memory Leak, Not Disposing Filtered Process Objects
  • #10309 - Mono issuing SIGSEGV running C# Semantic Tests
  • #10483 - iOS cannot save Entity models with Nullable Guid (Guid?) property types (among others) using EF Core 2.1.2.
  • #6173 - Periodic heapshot mode calculates time difference incorrectly
  • #6466 - System.Diagnostics.ProcessTest.Start1_FileName_NotFound failing on newer Ubuntu
  • #6647 - Jagged arrays cannot be cast to IList<>
  • #6834 - Frequent timing out of the ‘monitor-abort’ tests on CI
  • #6936 - Mono runtime doesn’t check modreqs for overriding methods
  • #7058 - [interp] pinvoke.exe is flaky
  • #7137 - Step in crashes debugger
  • #7247 - CoreFX System.Text namespace
  • #7260 - StackTrace.GetFrames() does not return frames from captured traces
  • #7305 - Stack overflow when hosting a WCF service when contract interface inherits other interfaces
  • #7356 - Memory leak in HttpWebRequest / HttpWebResponse
  • #7402 - [interp] fix System.Threading.ThreadTest.Test_Interrupt
  • #7525 - Profiler exception clause reporting is broken
  • #7610 - Add System.Memory facade
  • #7649 - Exception stacktrace is null when task delegate is created from local function
  • #7655 - Memory leak in file operations in mono 5.10
  • #7683 - Assertion at /Users/builder/data/lanes/5808/1c6f300e/source/xamarin-macios/external/mono/mono/profiler/log.c:546, condition `mono_lls_insert (&log_profiler.profiler_thread_list, hp, &thread->node) && “Why can’t we insert the thread in the LLS?”’ not met
  • #7685 - Assert ainfo->cinfo->stack_usage % MONO_ARCH_FRAME_ALIGNMENT == 0
  • #7716 - mono’s mscorlib.xml descriptor file seems incomplete for Xamarin.Mac
  • #7731 - MKBundle fails on Windows due to a folder check/missing folder
  • #7785 - Dead link (404) in a runtime execution engine exception
  • #7828 - Invalid instruction generated by regex runtime when using dapper
  • #7944 - CreateDelegate produces delegate wrapping incorrect method
  • #7947 - Missing forwarders from System.Runtime.Extensions
  • #8036 - Update API diff to ignore more attributes
  • #8074 - signing problems in preset fullaot build
  • #8089 - Add System.Drawing.Common facade for Xamarin profiles
  • #8112 - Wrong maximal instruction length of instruction tailcall_membase on ARM64
  • #8122 - CoreFX System.Xml.Linq
  • #8143 - CEE_STELEM for single token fails in wasm interp mode
  • #8149 - Assembly.LoadFile and Assembly.LoadFrom have same behavior
  • #8175 - Changing eglib doesn’t rebuild mono
  • #8177 - [wasm] master broken due to WASM-ERR: missing function: mono_debugger_agent_init
  • #8218 - SN fails when signing x64 assemblies
  • #8250 - assertion failure fullaot llvm System.Drawing.dll
  • #8267 - TimeZoneInfo.Local Id and DisplayName are always: Local
  • #8282 - [android] respect maximum length of a message when using __android_log_write ()
  • #8310 - FSharp build is broken due to new Path.GetFileName() overload
  • #8311 - bug-82022.exe fails in LLVM JIT
  • #8321 - Build break/test failures on FullAOT+LLVM configuration
  • #8329 - mono –interpreter got * Assertion at ..\mono\mini\interp\interp.c:3557, condition `csig->call_convention == MONO_CALL_DEFAULT’ not met
  • #8340 - Issue with black text on console, possibly ncurses
  • #8356 - Hybrid suspend: backtrace in GC Unsafe mode considered harmful (on Linux)
  • #8372 - unload-appdomain-on-shutdown.exe flaky test
  • #8407 - TypeDescriptorTest.TestCreateDesigner and TestGetAttributes broken on FullAOT
  • #8409 - FullAOT test failures/crashes on arm64,armel or armhf
  • #8417 - Redirecting process output when Console.SetOut set gives strange output
  • #8422 - Ambiguous call Encoding.GetByteCount(char[], int, int) and Encoding.GetByteCount(string, int, int)
  • #8430 - Fails to compile without AOT (enable-minimal=profiler,debug,aot)
  • #8447 - ilasm can’t assemble vbbyrefstr parameters
  • #8469 - API/Project Files diff renderer stops at XML end comment –>
  • #8473 - ThreadPoolTests.PerformanceCounter_WorkItems fails occasionally
  • #8488 - Doesn’t compile with Clang on ARM64
  • #8572 - Build fails on Redhat 6.8 with GCC 4.4.7
  • #8575 - GetCustomAttributes on a type from an assembly in the LoadFile context fails
  • #8587 - configure.ac G_HAVE_ISO_VARARGS problems
  • #8597 - System.Reflection.Emit: ParameterBuilder.SetConstant(value) throws ArgumentException for nullable value typed parameters
  • #8623 - Complete the System.Memory types import
  • #8698 - csharp REPL can’t load pkg-config references interactively
  • #8701 - AOT failure if ref readonly with generics is used
  • #8712 - FileSystemWatcher only works for one instance
  • #8721 - System.Threading.Tasks.TaskFactoryTests.FromAsync_BeginCallback failing under XM with 2018-04
  • #8726 - Loading denied assemblies via Assembly.LoadFrom can cause issues, eg. for VSMac
  • #8759 - Build of Master fails with GCC 4.4.7
  • #8787 - ThreadPrincipalTests.PrincipalFlowsToAsyncTask failure on device
  • #8820 - [loader] Mono is too strict when checking for already loaded assemblies.
  • #8848 - Error when debugging
  • #8866 - jit profiler option crashes iOS apps
  • #8897 - “Microsoft.Managed.Core.targets” is missing from roslyn-binaries
  • #8915 - Using BinaryFormatter to deserialize an array in a struct in a parent class fails with unfriendly exception [reproducible test case i promise]
  • #8979 - configure script incorrectly assumes functions are available with some conditions
  • #9002 - ServiceControllerTest.cs is designed to fail.
  • #9023 - Two ValueType properties initialization inline fails in mono-wasm
  • #9031 - HttpWebRequest.EndGetRequestStream throws wrong exception on abort
  • #9033 - DynamicMethod creation fails with “method arguments are incompatible”
  • #9179 - CI build breakage for 2018-04, msbuild
  • #9234 - [System]: Renegotiation in AppleTls requires OS X 10.12+
  • #9277 - Cannot get the exit code from a non-child process on Unix (on Windows)
  • #9318 - watchOS: “fastcc” not supported with Xcode 10’s clang
  • #9753 - [loader] LoadFile from application base should load in default context
  • #9839 - Behaviour difference between Mono and CoreCLR
  • #9869 - iOS: mini test failure in release/llvm mode (JitTests.Math: Expected: 0 But was: 1)
  • #9870 - iOS: 32-bit device unit test failure: [FAIL] FSharpTest.SprintfTest : Expected: True
  • #9943 - System.Reflection.Assembly.LoadFile should throw ArgumentException for relative path name
  • #9996 - The type initializer for ‘System.Data.Entity.Core.Objects.ELinq.ExpressionConverter’ threw an exception. (regression in Mono 5.14)
  • Bugzilla 19436 - [eglib] GMarkup XML parser can’t handle hyphens underscores and periods in element names.
  • Bugzilla 23668 - System.Net.Http.Formatting should not contain Newtonsoft.Json
  • Bugzilla 26983 - Console properties might deadlock for background properties
  • Bugzilla 46917 - Incorrect validation checks in message formater
  • Bugzilla 60065 - Make exception marshaling work with system mono

Contributors

Aleksey Kliger, Alex Rønne Petersen, Alexander Kyte, Alexander Köplinger, Alexis Christoforides, Andoni Morales Alastruey, Ankit Jain, Atsushi Eno, Ben Adams, Bernhard Urban, Calvin Buckley, Cody Russell, Daniel Becker, David Benjamin, Egor Bogatov, Filip Navara, Hugh Bellamy, Jay Krell, Jo Shields, Jonathan Chambers, Jonathan Peppers, Jonathan Pryor, Joshua Peterson, José Manuel Serrano Mármol, Kadirov Yurij, Katelyn Gadd, Ludovic Henry, Marek Habersack, Marek Safar, Martin Baulig, Maxim Lipnin, Miguel de Icaza, Mikayla Hutchinson, Mike Voorhees, Mikhail Filippov, Neale Ferguson, Nick Craver, Niklas Therning, Paul Fertser, Petr Onderka, Rodrigo Kumpera, Rolf Bjarne Kvinge, Sebastien Pouliot, Tom Dowdell, Tony Di Nucci, Tony Valenti, Vincent Povirk, Vlad Brezae, Zoltan Varga, hgy59, hharyono, iamphi, rbazinet-exago, sancheolz