--- layout: releasenotes title: 'Mono 5.2.0 Release Notes' version: 5.2.0 releasedate: '2017-08-14' --- ## Release History - 5.2.0.224 - Service Release *(12 September 2017)* - 5.2.0.215 - Stable Release *(14 August 2017)* - 5.2.0.215 - Beta Release *(01 August 2017)* - 5.2.0.213 - Beta Release *(24 July 2017)* - 5.2.0.209 - Beta Release *(12 July 2017)* - 5.2.0.196 - Beta Release *(29 June 2017)* - 5.2.0.179 - Beta Release *(15 June 2017)* - 5.2.0.104 - Alpha Release *(11 May 2017)* ## Highlights - [`mono` command defaults to 64bit](#mono-command-defaults-to-64bit) - [Experimental Default Interface Methods Support](#experimental-default-interface-methods-support) ## In Depth ### Strong assembly names Mono will now optionally respect public keys and version numbers when loading strongly signed assemblies. If Mono is invoked with the `--assembly-loader=strict` option, then requests (whether via a static assembly reference, or using an assembly name using the reflection API) that include a public key token and version number will only load strong named assemblies with a matching token and name (respecting any bindings in relevant app config files). To debug the assembly loading process, set the logging environment variables to trace level "info" or lower and trace filter to include "asm". (See [Logging runtime events](/docs/advanced/runtime/logging-runtime-events/).) The current default behavior is the same as in previous Mono versions. It is explicitly available with the `--assembly-loader=legacy` option. ### Experimental Default Interface Methods Support We added experimental support for the current prototype. Check the [C# specs](https://github.com/dotnet/csharplang/blob/master/proposals/default-interface-methods.md) ### Class Libraries #### System.Numerics.Vectors Multiple fixes and new intrinsics added. The library is now considered ready for general usage. #### .NET Standard 2.0 groundwork We've done all the groundwork to support libraries that conform to .NET Standard 2.0. Loading and running a library compiled against the 2.0 standard should work fine, tooling support (i.e. creating a .NET Standard 2.0 library) is still in preview though. You'll need to install the [.NET Core 2.0 SDK](https://www.microsoft.com/net/core) for tooling support as we use the MSBuild tasks which are installed as part of the .NET Core 2.0 SDK, similar to how Visual Studio/MSBuild on Windows does it. #### Reference assemblies The reference assemblies were updated to provide the .NET 4.7 API set. ### Runtime #### `mono` command defaults to 64bit The `mono` command now runs as a 64bit application by default. You can use the `--arch=32` option to run Mono as 32bit again. #### Optimized Array Stores Added a fast path for storing on array of reference values when the stored value is of the same type of the array element type. #### Class Initialization Improvements Do hold any runtime locks while running the class initializer. This improves startup scalability. #### Reduced minor collection pause times Made the runtime tables used to store reflection information generational, so the GC can avoid scanning them during minor collections. Those tables can become significantly large on workloads like Visual Studio for Mac. #### Interpreter passes the majority of the JIT test suite Major progress was made on the interpreter front. It can now run non-trivial programs. ### Misc #### Internal Documentation We continue to publish [internal docs for mono](http://www.mono-project.com/api/), making it more convenient to browse and search the Mono runtime internals and associated documentation. #### Static Analysis In order to holistically improve the correctness and stability of Mono, we have been investing effort in custom [static analysis tooling](https://github.com/evincarofautumn/Ward), which will be deployed as part of our continuous build to rule out certain classes of bugs. Recently we have made progress on minimizing the amount of manual annotation work required to add new analyses, making it easier for us to verify more properties of our code. #### Mangler V1 Managed methods can include a dizzying array of attributes beyond the actual method code. The mangler encodes the attributes which are necessary to create a unique name for each method. If two methods mangle to the same string, they are the same method. This can be thought of as a primary key for each method, and extends to methods which are mono wrappers. Internally, mono is using it to build a deduplicating pass to remove binary bloat associated with generics. #### Safer Getenv The functions g_getenv and g_setenv are neither threadsafe nor reentrant. Subsequent calls to g_getenv can cause previous strings returned from it to point to garbage memory. This was leading to issues with System.Configuration that could be seen with HttpClient. Now we lock around these calls and return duplicated memory. This is a serious API change to g_getenv. The string returned must now always be freed. We don't expect many embedders to be using the version of eglib that is linked into mono for other functions. Those who do might want to check that this change does not introduce memory leaks. ## Bug Fixes - [#580](https://bugzilla.xamarin.com/show_bug.cgi?id=580) - Type.Load loads strong type despite version mismatch - [#39444](https://bugzilla.xamarin.com/show_bug.cgi?id=39444) - Action ReflectedType differs from Delegate ReflectedType for virutal methods - [#43805](https://bugzilla.xamarin.com/show_bug.cgi?id=43805) - Output of DateTime.Now() differs on Mono for ambiguous time period - [#43988](https://bugzilla.xamarin.com/show_bug.cgi?id=43988) - Stack overflow in System.Text.Encoding.Default - [#46661](https://bugzilla.xamarin.com/show_bug.cgi?id=46661) - Runtime exception filters truncate exception stack traces on NSLog - [#46929](https://bugzilla.xamarin.com/show_bug.cgi?id=46929) - Datetime error on Mono.data.Sqlite - [#47221](https://bugzilla.xamarin.com/show_bug.cgi?id=47221) - Thread.Name can only be set once inside async callback - [#47599](https://bugzilla.xamarin.com/show_bug.cgi?id=47599) - HttpClient Transfer-Encoding:chunked is not added to the header - not able to transfer large files - [#49721](https://bugzilla.xamarin.com/show_bug.cgi?id=49721) - Assembly binder uses wrong strongly named assembly when same assembly with different version exists in local folder - [#50529](https://bugzilla.xamarin.com/show_bug.cgi?id=50529) - crash in thread-native-exit.exe - [#51522](https://bugzilla.xamarin.com/show_bug.cgi?id=51522) - Overload resolution fails for referenced assembly - [#51561](https://bugzilla.xamarin.com/show_bug.cgi?id=51561) - Getting process name of process running under higher privilege user throws exception - [#51653](https://bugzilla.xamarin.com/show_bug.cgi?id=51653) - mono_thread_info_wait_one_handle ignored alertable argument - [#52086](https://bugzilla.xamarin.com/show_bug.cgi?id=52086) - Nullable structs with implicit operators generate invalid IL code when compiling with Mono - [#52294](https://bugzilla.xamarin.com/show_bug.cgi?id=52294) - C# compiler reports an incorrect error in a lambda with generic constraints - [#52340](https://bugzilla.xamarin.com/show_bug.cgi?id=52340) - Compiler crashes with FATAL UNHANDLED EXCEPTION (nullref) - [#52345](https://bugzilla.xamarin.com/show_bug.cgi?id=52345) - Process has exited, so the requested information is not available - [#52429](https://bugzilla.xamarin.com/show_bug.cgi?id=52429) - Shutdown hang then crash in Finalizer thread - [#52437](https://bugzilla.xamarin.com/show_bug.cgi?id=52437) - Random NullReferenceExceptions in StringBuilder.ThreadSafeCopy - [#52448](https://bugzilla.xamarin.com/show_bug.cgi?id=52448) - StreamContent apparently needs to rewind stream before sending it - [#52475](https://bugzilla.xamarin.com/show_bug.cgi?id=52475) - MTOUCH: error MT3001: Could not AOT the assembly - [#52511](https://bugzilla.xamarin.com/show_bug.cgi?id=52511) - configure script doen't detect bad configuration - [#52549](https://bugzilla.xamarin.com/show_bug.cgi?id=52549) - error: mono_w32socket_convert_error: no translation into winsock error for (41) "Protocol wrong type for socket" - [#52590](https://bugzilla.xamarin.com/show_bug.cgi?id=52590) - Cannot compile for iOS, TypeBuilder exists in two places. - [#52599](https://bugzilla.xamarin.com/show_bug.cgi?id=52599) - await in finally clause prevents disposal of enclosing using statement - [#52600](https://bugzilla.xamarin.com/show_bug.cgi?id=52600) - Full AOT: Strange combination of structs, generics, and enums causes runtime failure - [#52743](https://bugzilla.xamarin.com/show_bug.cgi?id=52743) - denied loading problems - [#52845](https://bugzilla.xamarin.com/show_bug.cgi?id=52845) - \[Cycle 9\] Satellite assemblies not bundled when using "Bundle assemblies into native code" due to "unknown escape sequence" error from gcc during mkbundle step - [#52866](https://bugzilla.xamarin.com/show_bug.cgi?id=52866) - F# sprintf AOT bug still exists - [#52899](https://bugzilla.xamarin.com/show_bug.cgi?id=52899) - mprof-report missing filenames in coverage xml output when using portable pdbs - [#53066](https://bugzilla.xamarin.com/show_bug.cgi?id=53066) - Can't Build Project in Debug with "Could not AOT the assembly" - [#53131](https://bugzilla.xamarin.com/show_bug.cgi?id=53131) - Calling MakeArray() on a type with a rank that is too big does not throw an exception. - [#53153](https://bugzilla.xamarin.com/show_bug.cgi?id=53153) - Implement RuntimeHelpers::IsReferenceOrContainsReferences - [#53166](https://bugzilla.xamarin.com/show_bug.cgi?id=53166) - Application crashes when setting a get-only property in constructor - [#53196](https://bugzilla.xamarin.com/show_bug.cgi?id=53196) - List\<\>.Sort() using insertion sort does not sort all values when equality isn't checked. - [#53202](https://bugzilla.xamarin.com/show_bug.cgi?id=53202) - Number minus Enum gives wrong value - [#53231](https://bugzilla.xamarin.com/show_bug.cgi?id=53231) - csc doesn't unify same file passed multiple times when one path is relative - [#53278](https://bugzilla.xamarin.com/show_bug.cgi?id=53278) - Two coreclr SIMD test failures (one regression from 4.8) - [#53334](https://bugzilla.xamarin.com/show_bug.cgi?id=53334) - es-US Culture wrong number formatting - [#53684](https://bugzilla.xamarin.com/show_bug.cgi?id=53684) - Crash when enumerating directory and selecting the first file - [#53689](https://bugzilla.xamarin.com/show_bug.cgi?id=53689) - \[Test\] Certificate7 disabled due to SecCertificateCreateWithData does different things on 10.11 vs 10.12 with invalid certificates - [#53792](https://bugzilla.xamarin.com/show_bug.cgi?id=53792) - CFNetworkHandler reports correct download when internet connection is lost during request - [#53843](https://bugzilla.xamarin.com/show_bug.cgi?id=53843) - Mono deadlocks on shutdown while waiting for a process which has died - [#53890](https://bugzilla.xamarin.com/show_bug.cgi?id=53890) - Regression: Native crash while running tests with xunit with mono 2017-02 branch, works with 4.8.0.520 - [#54212](https://bugzilla.xamarin.com/show_bug.cgi?id=54212) - Mono allows casts of non-zero bound array to zero bound array - [#54322](https://bugzilla.xamarin.com/show_bug.cgi?id=54322) - await in catch-block inside a loop causes the same exception to be caught multiple times - [#54448](https://bugzilla.xamarin.com/show_bug.cgi?id=54448) - Unable to revert to thread-local storage for CurrentThread.CultureInfo - [#54485](https://bugzilla.xamarin.com/show_bug.cgi?id=54485) - Creating an open generic type with recurrent constraint fails - [#54991](https://bugzilla.xamarin.com/show_bug.cgi?id=54991) - Cannot compile get => \_text - [#55041](https://bugzilla.xamarin.com/show_bug.cgi?id=55041) - Stripping mscorlib in simple example changes IntPtr (5) behavior? - [#55083](https://bugzilla.xamarin.com/show_bug.cgi?id=55083) - coreclr test b353858.il fails after 6f33b62f39a273fccb78f71513cb5e0dfb987c70 - [#55436](https://bugzilla.xamarin.com/show_bug.cgi?id=55436) - System.Runtime refuses to load with strict naming - [#55577](https://bugzilla.xamarin.com/show_bug.cgi?id=55577) - SIMD instructions with System.Numerics.Vectors do not work - [#55603](https://bugzilla.xamarin.com/show_bug.cgi?id=55603) - Follow-up to bug 52845: Satellite assemblies not loaded by app when using "Bundle assemblies into native code" even though they are now successfully mkbundled - [#55681](https://bugzilla.xamarin.com/show_bug.cgi?id=55681) - System.Reflection.Emit.ModuleBuilder.build_metadata bug when running FAKE's test suite - [#56081](https://bugzilla.xamarin.com/show_bug.cgi?id=56081) - Returning a valuetype from an async method with an awaited parameter yields a Mono.CSharp.InternalErrorException: Await yields with non-empty stack - [#56240](https://bugzilla.xamarin.com/show_bug.cgi?id=56240) - Performance Degradation When Using Expressions - [#56247](https://bugzilla.xamarin.com/show_bug.cgi?id=56247) - Enumerable.OrderByDescending behaves differently on LLVM FullAOT - [#56275](https://bugzilla.xamarin.com/show_bug.cgi?id=56275) - Unable to copy appname.dll from obj to bin because it is being used by another process - [#56493](https://bugzilla.xamarin.com/show_bug.cgi?id=56493) - Windows MMAP doesn't release file - [#56567](https://bugzilla.xamarin.com/show_bug.cgi?id=56567) - Passing large struct into exception filter method crashes runtime with SIGSEGV - [#56611](https://bugzilla.xamarin.com/show_bug.cgi?id=56611) - Regression: ArrayTypeMismatchException when running F# script - [#56694](https://bugzilla.xamarin.com/show_bug.cgi?id=56694) - Assertion: should not be reached at d:\\j\\workspace\\v\\repos\\mono\\mono\\sgen\\sgen-scan-object.h:91 - [#56821](https://bugzilla.xamarin.com/show_bug.cgi?id=56821) - Static ctor of MarshalByRefObject runs in primary AppDomain - [#56824](https://bugzilla.xamarin.com/show_bug.cgi?id=56824) - Runtime crash with VSMEF - [#57222](https://bugzilla.xamarin.com/show_bug.cgi?id=57222) - System.Reflection.AmbiguousMatchException for two fields with same name but different types - [#57744](https://bugzilla.xamarin.com/show_bug.cgi?id=57744) - ReflectionTypeLoadException.LoaderExceptions has null exceptions ## Contributors Aaron Bockover, Adrian Cheng, Aleksey Kliger, Alexander Köplinger, Alexander Kyte, Alexis Christoforides, Andi McClure, Andoni Morales Alastruey, Ankit Jain, Bernhard Urban, Brian Raderman, Calvin Buckley, Chris Hamons, Cody Russell, Damien Diederen, Daniel C. Weber, David Karlaš, Dean Ellis, Eberhard Beilharz, Edward Betts, Egor Bogatov, Filip Navara, Francois Botha, Frederik Carlier, Jan-Joost Spanjers, Jb Evain, Johan Lorensson, Jonathan Chambers, Jonathan Pryor, Jon Purdy, Ludovic Henry, Luis Aguilera, Manuel de la Pena, Marcin Cieślak, Marek Habersack, Marek Safar, Martin Baulig, Mathieu Bourgeois, Michael DeRoy, Miguel de Icaza, Mikayla Hutchinson, Neale Ferguson, Niklas Therning, Nikolay Amiantov, Jaymin Patel, Rodrigo Kumpera, Rolf Bjarne Kvinge, Pei Su, Vincent Povirk, Vlad Brezae, Vladimir Kargov, Vladimir Kazakov, Zoltan Varga