From 61f46a49e07d422bfb5ca7b32234b9ad1405fa07 Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 18 Nov 2020 14:35:45 +0100 Subject: Add .NET 5.0 support (#1154) --- csharp/src/Glacier2/msbuild/net5.0/glacier2.csproj | 22 +++++++++++++++++ csharp/src/Ice/AssemblyUtil.cs | 2 +- csharp/src/Ice/DispatchInterceptor.cs | 4 +++- csharp/src/Ice/InputStream.cs | 2 ++ csharp/src/Ice/ObjectAdapterFactory.cs | 8 +++---- csharp/src/Ice/Optional.cs | 4 ---- csharp/src/Ice/OutputStream.cs | 2 ++ csharp/src/Ice/PluginManagerI.cs | 2 ++ csharp/src/Ice/msbuild/net5.0/ice.csproj | 19 +++++++++++++++ csharp/src/IceBox/ServiceManagerI.cs | 6 +++-- .../src/IceBox/msbuild/icebox/net5.0/icebox.csproj | 28 ++++++++++++++++++++++ .../msbuild/iceboxlib/net5.0/iceboxlib.csproj | 22 +++++++++++++++++ .../msbuild/net5.0/icediscovery.csproj | 22 +++++++++++++++++ .../msbuild/netstandard2.0/icediscovery.csproj | 2 +- csharp/src/IceGrid/msbuild/net5.0/icegrid.csproj | 23 ++++++++++++++++++ .../msbuild/net5.0/icelocatordiscovery.csproj | 22 +++++++++++++++++ csharp/src/IceSSL/SSLEngine.cs | 8 +++++-- csharp/src/IceSSL/msbuild/net5.0/icessl.csproj | 22 +++++++++++++++++ csharp/src/IceStorm/msbuild/net5.0/icestorm.csproj | 22 +++++++++++++++++ 19 files changed, 227 insertions(+), 15 deletions(-) create mode 100644 csharp/src/Glacier2/msbuild/net5.0/glacier2.csproj create mode 100644 csharp/src/Ice/msbuild/net5.0/ice.csproj create mode 100644 csharp/src/IceBox/msbuild/icebox/net5.0/icebox.csproj create mode 100644 csharp/src/IceBox/msbuild/iceboxlib/net5.0/iceboxlib.csproj create mode 100644 csharp/src/IceDiscovery/msbuild/net5.0/icediscovery.csproj create mode 100644 csharp/src/IceGrid/msbuild/net5.0/icegrid.csproj create mode 100644 csharp/src/IceLocatorDiscovery/msbuild/net5.0/icelocatordiscovery.csproj create mode 100644 csharp/src/IceSSL/msbuild/net5.0/icessl.csproj create mode 100644 csharp/src/IceStorm/msbuild/net5.0/icestorm.csproj (limited to 'csharp/src') diff --git a/csharp/src/Glacier2/msbuild/net5.0/glacier2.csproj b/csharp/src/Glacier2/msbuild/net5.0/glacier2.csproj new file mode 100644 index 00000000000..283eb665369 --- /dev/null +++ b/csharp/src/Glacier2/msbuild/net5.0/glacier2.csproj @@ -0,0 +1,22 @@ + + + + + Glacier2 + $(IceVersion) + ../../../../lib + net5.0 + + + + + + + + + + + + + + diff --git a/csharp/src/Ice/AssemblyUtil.cs b/csharp/src/Ice/AssemblyUtil.cs index a594b1d6d6a..44b44b1e95e 100644 --- a/csharp/src/Ice/AssemblyUtil.cs +++ b/csharp/src/Ice/AssemblyUtil.cs @@ -12,7 +12,7 @@ namespace IceInternal public sealed class AssemblyUtil { -#if NETSTANDARD2_0 +#if NET5_0 || NETSTANDARD2_0 public static readonly bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); public static readonly bool isMacOS = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); public static readonly bool isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); diff --git a/csharp/src/Ice/DispatchInterceptor.cs b/csharp/src/Ice/DispatchInterceptor.cs index 54e39251ac6..52685fa6c86 100644 --- a/csharp/src/Ice/DispatchInterceptor.cs +++ b/csharp/src/Ice/DispatchInterceptor.cs @@ -37,7 +37,9 @@ namespace Ice // encoding version used by the client to eventually marshal the user exception. It's also needed // if we dispatch a batch oneway request to read the next batch request. // - if(current.encoding == null || (current.encoding.major == 0 && current.encoding.minor == 0)) +#pragma warning disable CS8073 // The result of the expression is always 'false' + if (current.encoding == null || (current.encoding.major == 0 && current.encoding.minor == 0)) +#pragma warning restore CS8073 // The result of the expression is always 'false' { inc.skipReadParams(); } diff --git a/csharp/src/Ice/InputStream.cs b/csharp/src/Ice/InputStream.cs index d71f3bd01ff..eafd7e5b843 100644 --- a/csharp/src/Ice/InputStream.cs +++ b/csharp/src/Ice/InputStream.cs @@ -1097,7 +1097,9 @@ namespace Ice try { var f = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.All, _instance)); +#pragma warning disable SYSLIB0011 // Type or member is obsolete return f.Deserialize(new IceInternal.InputStreamWrapper(sz, this)); +#pragma warning restore SYSLIB0011 // Type or member is obsolete } catch(System.Exception ex) { diff --git a/csharp/src/Ice/ObjectAdapterFactory.cs b/csharp/src/Ice/ObjectAdapterFactory.cs index ca991d86dde..f87420105ff 100644 --- a/csharp/src/Ice/ObjectAdapterFactory.cs +++ b/csharp/src/Ice/ObjectAdapterFactory.cs @@ -175,15 +175,15 @@ namespace IceInternal _adapters.Add(adapter); } } - catch(Ice.CommunicatorDestroyedException ex) + catch(Ice.CommunicatorDestroyedException) { if(adapter != null) { adapter.destroy(); } - throw ex; + throw; } - catch(Ice.LocalException ex) + catch(Ice.LocalException) { if(name.Length > 0) { @@ -192,7 +192,7 @@ namespace IceInternal _adapterNamesInUse.Remove(name); } } - throw ex; + throw; } return adapter; diff --git a/csharp/src/Ice/Optional.cs b/csharp/src/Ice/Optional.cs index cbcdecfb929..4bfe510ee88 100644 --- a/csharp/src/Ice/Optional.cs +++ b/csharp/src/Ice/Optional.cs @@ -121,10 +121,6 @@ namespace Ice public override bool Equals(object other) { - if(ReferenceEquals(this, other)) - { - return true; - } if(other == null) { return false; diff --git a/csharp/src/Ice/OutputStream.cs b/csharp/src/Ice/OutputStream.cs index d87491b83f4..bf79911e643 100644 --- a/csharp/src/Ice/OutputStream.cs +++ b/csharp/src/Ice/OutputStream.cs @@ -727,7 +727,9 @@ namespace Ice { IceInternal.OutputStreamWrapper w = new IceInternal.OutputStreamWrapper(this); IFormatter f = new BinaryFormatter(); +#pragma warning disable SYSLIB0011 // Type or member is obsolete f.Serialize(w, o); +#pragma warning restore SYSLIB0011 // Type or member is obsolete w.Close(); } catch(System.Exception ex) diff --git a/csharp/src/Ice/PluginManagerI.cs b/csharp/src/Ice/PluginManagerI.cs index b773ba595cb..8e841ab230d 100644 --- a/csharp/src/Ice/PluginManagerI.cs +++ b/csharp/src/Ice/PluginManagerI.cs @@ -451,7 +451,9 @@ namespace Ice } catch(System.IO.IOException) { +#pragma warning disable CA2200 // Rethrow to preserve stack details throw ex; +#pragma warning restore CA2200 // Rethrow to preserve stack details } } } diff --git a/csharp/src/Ice/msbuild/net5.0/ice.csproj b/csharp/src/Ice/msbuild/net5.0/ice.csproj new file mode 100644 index 00000000000..c37215f6906 --- /dev/null +++ b/csharp/src/Ice/msbuild/net5.0/ice.csproj @@ -0,0 +1,19 @@ + + + + + Ice + $(IceVersion) + ../../../../lib + net5.0 + + + + + + + + + + + diff --git a/csharp/src/IceBox/ServiceManagerI.cs b/csharp/src/IceBox/ServiceManagerI.cs index 68b47540f31..bd0ef6e72ff 100644 --- a/csharp/src/IceBox/ServiceManagerI.cs +++ b/csharp/src/IceBox/ServiceManagerI.cs @@ -492,8 +492,10 @@ class ServiceManagerI : ServiceManagerDisp_ } catch(Exception) { - throw ex; - } +#pragma warning disable CA2200 // Rethrow to preserve stack details + throw ex; +#pragma warning restore CA2200 // Rethrow to preserve stack details + } } } catch(Exception ex) diff --git a/csharp/src/IceBox/msbuild/icebox/net5.0/icebox.csproj b/csharp/src/IceBox/msbuild/icebox/net5.0/icebox.csproj new file mode 100644 index 00000000000..43eaea51f5e --- /dev/null +++ b/csharp/src/IceBox/msbuild/icebox/net5.0/icebox.csproj @@ -0,0 +1,28 @@ + + + + + Exe + iceboxnet + $(IceVersion) + ../../../../../bin + net5.0 + + + true + + + + + + + + + + + + + + + + diff --git a/csharp/src/IceBox/msbuild/iceboxlib/net5.0/iceboxlib.csproj b/csharp/src/IceBox/msbuild/iceboxlib/net5.0/iceboxlib.csproj new file mode 100644 index 00000000000..6537c509d68 --- /dev/null +++ b/csharp/src/IceBox/msbuild/iceboxlib/net5.0/iceboxlib.csproj @@ -0,0 +1,22 @@ + + + + + IceBox + $(IceVersion) + ../../../../../lib + net5.0 + + + + + + + + + + + + + + diff --git a/csharp/src/IceDiscovery/msbuild/net5.0/icediscovery.csproj b/csharp/src/IceDiscovery/msbuild/net5.0/icediscovery.csproj new file mode 100644 index 00000000000..5dfd41b7540 --- /dev/null +++ b/csharp/src/IceDiscovery/msbuild/net5.0/icediscovery.csproj @@ -0,0 +1,22 @@ + + + + + IceDiscovery + $(IceVersion) + ../../../../lib + net5.0 + + + + + + + + + + + + + + diff --git a/csharp/src/IceDiscovery/msbuild/netstandard2.0/icediscovery.csproj b/csharp/src/IceDiscovery/msbuild/netstandard2.0/icediscovery.csproj index b0ecf5bf049..6435ea0679b 100644 --- a/csharp/src/IceDiscovery/msbuild/netstandard2.0/icediscovery.csproj +++ b/csharp/src/IceDiscovery/msbuild/netstandard2.0/icediscovery.csproj @@ -5,7 +5,7 @@ IceDiscovery $(IceVersion) ../../../../lib - netstandard2.0 + netstandard2.0 diff --git a/csharp/src/IceGrid/msbuild/net5.0/icegrid.csproj b/csharp/src/IceGrid/msbuild/net5.0/icegrid.csproj new file mode 100644 index 00000000000..06a244f968d --- /dev/null +++ b/csharp/src/IceGrid/msbuild/net5.0/icegrid.csproj @@ -0,0 +1,23 @@ + + + + + IceGrid + $(IceVersion) + ../../../../lib + net5.0 + + + + + + + + + + + + + + + diff --git a/csharp/src/IceLocatorDiscovery/msbuild/net5.0/icelocatordiscovery.csproj b/csharp/src/IceLocatorDiscovery/msbuild/net5.0/icelocatordiscovery.csproj new file mode 100644 index 00000000000..9ad031a957a --- /dev/null +++ b/csharp/src/IceLocatorDiscovery/msbuild/net5.0/icelocatordiscovery.csproj @@ -0,0 +1,22 @@ + + + + + IceLocatorDiscovery + $(IceVersion) + ../../../../lib + net5.0 + + + + + + + + + + + + + + diff --git a/csharp/src/IceSSL/SSLEngine.cs b/csharp/src/IceSSL/SSLEngine.cs index 34b381ac3ca..15fdbac1ceb 100644 --- a/csharp/src/IceSSL/SSLEngine.cs +++ b/csharp/src/IceSSL/SSLEngine.cs @@ -75,7 +75,9 @@ namespace IceSSL _protocols = 0; foreach(int v in Enum.GetValues(typeof(SslProtocols))) { - if(v > (int)SslProtocols.Ssl3 && v != (int)SslProtocols.Default) +#pragma warning disable CS0618 // Type or member is obsolete + if (v > (int)SslProtocols.Ssl3 && v != (int)SslProtocols.Default) +#pragma warning restore CS0618 // Type or member is obsolete { _protocols |= (SslProtocols)v; } @@ -637,9 +639,11 @@ namespace IceSSL private SslProtocols parseProtocols(string[] arr) { +#pragma warning disable CS0618 // Type or member is obsolete SslProtocols result = SslProtocols.Default; +#pragma warning restore CS0618 // Type or member is obsolete - if(arr.Length > 0) + if (arr.Length > 0) { result = 0; for(int i = 0; i < arr.Length; ++i) diff --git a/csharp/src/IceSSL/msbuild/net5.0/icessl.csproj b/csharp/src/IceSSL/msbuild/net5.0/icessl.csproj new file mode 100644 index 00000000000..6d0e578cf97 --- /dev/null +++ b/csharp/src/IceSSL/msbuild/net5.0/icessl.csproj @@ -0,0 +1,22 @@ + + + + + IceSSL + $(IceVersion) + ../../../../lib + net5.0 + + + + + + + + + + + + + + diff --git a/csharp/src/IceStorm/msbuild/net5.0/icestorm.csproj b/csharp/src/IceStorm/msbuild/net5.0/icestorm.csproj new file mode 100644 index 00000000000..1e9fcd4433d --- /dev/null +++ b/csharp/src/IceStorm/msbuild/net5.0/icestorm.csproj @@ -0,0 +1,22 @@ + + + + + IceStorm + $(IceVersion) + ../../../../lib + net5.0 + + + + + + + + + + + + + + -- cgit v1.2.3