From 37fe83f6eaf073ae7ecd470bf3d2541af5829652 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 30 May 2017 18:34:53 +0200 Subject: [PATCH] [S.R.I.RuntimeInformation] Fix FrameworkDescription on Android (#4946) * [S.R.I.RuntimeInformation] Fix FrameworkDescription on Android It turns out using `DllImport ["__Internal"]` doesn't work on XA (and other cases where Mono is embedded) because it searches for the method in the host which embeds Mono and doesn't find it, resulting in an EntryPointNotFoundException. We need to switch to an icall instead. However there's already an existing icall+BCL wrapper: Mono.Runtime.GetDisplayName(). Added IVT from corlib to S.R.I.RuntimeInformation so we can call it. * Update API snapshot --- external/api-snapshot | 2 +- .../Makefile | 2 +- .../System.Runtime.InteropServices/RuntimeInformation.cs | 5 +---- mcs/class/corlib/Assembly/AssemblyInfo.cs | 2 ++ 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/external/api-snapshot b/external/api-snapshot index 13f1e219657..d207a517b26 160000 --- a/external/api-snapshot +++ b/external/api-snapshot @@ -1 +1 @@ -Subproject commit 13f1e2196575e56a657f49138d35082ae63a46ed +Subproject commit d207a517b2655cd4af5dd3b7735d8f6e139fafae diff --git a/mcs/class/Facades/System.Runtime.InteropServices.RuntimeInformation/Makefile b/mcs/class/Facades/System.Runtime.InteropServices.RuntimeInformation/Makefile index c3005ea20a0..fe76e860baa 100644 --- a/mcs/class/Facades/System.Runtime.InteropServices.RuntimeInformation/Makefile +++ b/mcs/class/Facades/System.Runtime.InteropServices.RuntimeInformation/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.InteropServices.RuntimeInformation.dll RESX_RESOURCE_STRING = ../../../../external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Resources/Strings.resx KEY_FILE = ../../msfinal.pub -SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 +SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699,436 LIB_REFS = System LIB_MCS_FLAGS = $(SIGN_FLAGS) /unsafe diff --git a/mcs/class/Facades/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/RuntimeInformation.cs b/mcs/class/Facades/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/RuntimeInformation.cs index d775167495e..4a515083c48 100644 --- a/mcs/class/Facades/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/RuntimeInformation.cs +++ b/mcs/class/Facades/System.Runtime.InteropServices.RuntimeInformation/System.Runtime.InteropServices/RuntimeInformation.cs @@ -35,12 +35,9 @@ namespace System.Runtime.InteropServices { public static class RuntimeInformation { - [DllImport ("__Internal")] - extern static string mono_get_runtime_build_info (); - public static string FrameworkDescription { get { - return mono_get_runtime_build_info (); + return "Mono " + Mono.Runtime.GetDisplayName (); } } diff --git a/mcs/class/corlib/Assembly/AssemblyInfo.cs b/mcs/class/corlib/Assembly/AssemblyInfo.cs index 6e1e9ef1264..54b21cdf3ba 100644 --- a/mcs/class/corlib/Assembly/AssemblyInfo.cs +++ b/mcs/class/corlib/Assembly/AssemblyInfo.cs @@ -79,6 +79,8 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000")] +[assembly: InternalsVisibleTo ("System.Runtime.InteropServices.RuntimeInformation, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] + #if MONOTOUCH #if MONOTOUCH_TV [assembly: InternalsVisibleTo ("Xamarin.TVOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -- 2.25.1