addressing some missing feedback Relating to Browser (#38968)
authorAnirudh Agnihotry <anirudhagnihotry098@gmail.com>
Fri, 10 Jul 2020 06:45:40 +0000 (23:45 -0700)
committerGitHub <noreply@github.com>
Fri, 10 Jul 2020 06:45:40 +0000 (23:45 -0700)
* addressing some missing feedback

* Apply suggestions from code review

Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
* remove odbc32 from ref

* fix stuff

Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
17 files changed:
eng/targetframeworksuffix.props
src/libraries/Microsoft.Win32.Primitives/src/Microsoft.Win32.Primitives.csproj
src/libraries/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.Default.cs [deleted file]
src/libraries/Microsoft.Win32.Primitives/tests/Microsoft.Win32.Primitives.Tests.csproj
src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs
src/libraries/System.Console/src/System.Console.csproj
src/libraries/System.Data.Odbc/ref/System.Data.Odbc.csproj
src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj
src/libraries/System.Data.Odbc/src/System/Data/Odbc/ODBC32.Common.cs [moved from src/libraries/System.Data.Odbc/ref/System.Data.Odbc.ODBC32.cs with 70% similarity]
src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs
src/libraries/System.Net.Http/src/System.Net.Http.csproj
src/libraries/System.Net.Mail/src/System.Net.Mail.csproj
src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj
src/libraries/System.Runtime.Caching/tests/AdditionalCacheTests/AdditionalCacheTests.cs
src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/MemoryCacheTest.cs
src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj
src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj

index 3c9b220..96cd8db 100644 (file)
@@ -88,8 +88,4 @@
       </PropertyGroup>
     </When>
   </Choose>
-
-  <PropertyGroup>
-    <EnablePInvokeAnalyzer Condition="'$(TargetsBrowser)' == 'true'">false</EnablePInvokeAnalyzer>
-  </PropertyGroup>
 </Project>
index 15502d6..e266af6 100644 (file)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)</TargetFrameworks>
+    <TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>
     <Nullable>enable</Nullable>
   </PropertyGroup>
   <ItemGroup>
              Link="Common\Interop\Windows\Interop.FormatMessage.cs" />
     <Compile Include="System\ComponentModel\Win32Exception.Windows.cs" />
   </ItemGroup>
-  <ItemGroup Condition=" '$(TargetsUnix)' == 'true'">
+  <ItemGroup Condition="'$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true'">
     <Compile Include="System\ComponentModel\Win32Exception.Unix.cs" />
     <Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs"
              Link="Common\Interop\Unix\Interop.Libraries.cs" />
     <Compile Include="$(CommonPath)Interop\Unix\Interop.Errors.cs"
              Link="Common\Interop\Unix\Interop.Errors.cs" />
   </ItemGroup>
-  <ItemGroup Condition="'$(TargetsAnyOS)' == 'true'">
-    <Compile Include="System\ComponentModel\Win32Exception.Default.cs" />
-  </ItemGroup>
   <ItemGroup>
     <Reference Include="System.Runtime" />
     <Reference Include="System.Runtime.InteropServices" />
diff --git a/src/libraries/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.Default.cs b/src/libraries/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.Default.cs
deleted file mode 100644 (file)
index 9fa1967..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-namespace System.ComponentModel
-{
-    public partial class Win32Exception
-    {
-        private static string GetErrorMessage(int error) => $"The process failed with error code {error}";
-    }
-}
index 897f82d..fd58739 100644 (file)
@@ -1,6 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)</TargetFrameworks>
+    <TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="Win32ExceptionTests.cs" />
index 7906b68..abb9737 100644 (file)
@@ -65,11 +65,18 @@ namespace System.Configuration
                 }
                 else
                 {
-                    // An EntryAssembly may not be found when running from a custom host.
-                    // Try to find the native entry point.
-                    using (Process currentProcess = Process.GetCurrentProcess())
+                    try
                     {
-                        ApplicationUri = currentProcess.MainModule?.FileName;
+                        // An EntryAssembly may not be found when running from a custom host.
+                        // Try to find the native entry point.
+                        using (Process currentProcess = Process.GetCurrentProcess())
+                        {
+                            ApplicationUri = currentProcess.MainModule?.FileName;
+                        }
+                    }
+                    catch (PlatformNotSupportedException)
+                    {
+                        ApplicationUri = string.Empty;
                     }
                 }
             }
index b64dcf1..1552dbf 100644 (file)
              Link="Common\System\Text\ValueStringBuilder.cs" />
   </ItemGroup>
   <!-- Unix -->
-  <ItemGroup Condition=" '$(TargetsUnix)' == 'true' and '$(TargetsAndroid)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetstvOS)' != 'true' and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition="'$(TargetsUnix)' == 'true' and '$(TargetsAndroid)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetstvOS)' != 'true'">
     <Compile Include="System\ConsolePal.Unix.cs" />
     <Compile Include="System\TermInfo.cs" />
     <Compile Include="System\IO\StdInReader.cs" />
index 248a81d..1aa56e7 100644 (file)
@@ -8,7 +8,6 @@
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="System.Data.Odbc.cs" />
-    <Compile Include="System.Data.Odbc.ODBC32.cs" Condition="!$(TargetFramework.StartsWith('net4'))" />
   </ItemGroup>
   <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
     <Reference Include="mscorlib" />
index c2c4890..0592f1d 100644 (file)
@@ -13,6 +13,9 @@
     <NoWarn Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)' and '$(TargetsAnyOS)' == 'true'">$(NoWarn);SA1121</NoWarn>
     <GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetsAnyOS)' == 'true'">SR.Odbc_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
   </PropertyGroup>
+  <ItemGroup Condition="$(TargetFramework.StartsWith('$(NetCoreAppCurrent)')) or $(TargetFramework.StartsWith('netcoreapp2.0'))" >
+    <Compile Include="System\Data\Odbc\ODBC32.Common.cs"/>
+  </ItemGroup>
   <ItemGroup Condition="($(TargetFramework.StartsWith('$(NetCoreAppCurrent)')) or $(TargetFramework.StartsWith('netcoreapp2.0'))) and '$(TargetsAnyOS)' != 'true'">
     <Compile Include="$(CommonPath)System\Data\Common\AdapterUtil.cs"
              Link="Common\System\Data\Common\AdapterUtil.cs" />
@@ -3,9 +3,12 @@
 
 namespace System.Data.Odbc
 {
+    // Class needs to be public to support serialization with type forwarding from Desktop to Core.
     [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
-    public static class ODBC32
+    public static partial class ODBC32
     {
+        // from .\public\sdk\inc\sqlext.h: and .\public\sdk\inc\sql.h
+        // must be public because it is serialized by OdbcException
         [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
         public enum RETCODE : int
         {
index df71cb1..1fed607 100644 (file)
@@ -122,9 +122,7 @@ namespace System.Data.Odbc
         }
     }
 
-    // Class needs to be public to support serialization with type forwarding from Desktop to Core.
-    [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
-    public static class ODBC32
+    public static partial class ODBC32
     {
         internal enum SQL_HANDLE : short
         {
@@ -134,18 +132,6 @@ namespace System.Data.Odbc
             DESC = 4,
         }
 
-        // from .\public\sdk\inc\sqlext.h: and .\public\sdk\inc\sql.h
-        // must be public because it is serialized by OdbcException
-        [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
-        public enum RETCODE : int
-        { // must be int instead of short for Everett OdbcException Serializablity.
-            SUCCESS = 0,
-            SUCCESS_WITH_INFO = 1,
-            ERROR = -1,
-            INVALID_HANDLE = -2,
-            NO_DATA = 100,
-        }
-
         // must be public because it is serialized by OdbcException
         internal enum RetCode : short
         {
index 9a33b22..6c03ef3 100644 (file)
@@ -11,7 +11,7 @@
   <PropertyGroup Condition=" '$(TargetsOSX)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true'">
     <DefineConstants>$(DefineConstants);SYSNETHTTP_NO_OPENSSL</DefineConstants>
   </PropertyGroup>
-  <PropertyGroup Condition=" '$(TargetsBrowser)' == 'true'">
+  <PropertyGroup Condition="'$(TargetsBrowser)' == 'true'">
     <DefineConstants>$(DefineConstants);TARGETS_BROWSER</DefineConstants>
   </PropertyGroup>
   <!-- ILLinker settings -->
              Link="Common\System\Net\ArrayBuffer.cs"/>
   </ItemGroup>
   <!-- SocketsHttpHandler implementation -->
-  <ItemGroup Condition=" '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition="'$(TargetsBrowser)' != 'true'">
     <Compile Include="System\Net\Http\SocketsHttpHandler\AuthenticationHelper.cs" />
     <Compile Include="System\Net\Http\SocketsHttpHandler\AuthenticationHelper.Digest.cs" />
     <Compile Include="System\Net\Http\SocketsHttpHandler\AuthenticationHelper.NtAuth.cs" />
              Link="Common\Interop\FreeBSD\Interop.Libraries.cs" />
   </ItemGroup>
   <!-- SocketsHttpHandler platform parts -->
-  <ItemGroup Condition=" '$(TargetsUnix)' == 'true' and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition=" '$(TargetsUnix)' == 'true'">
     <Compile Include="System\Net\Http\SocketsHttpHandler\HttpEnvironmentProxy.cs" />
     <Compile Include="System\Net\Http\SocketsHttpHandler\HttpEnvironmentProxy.Unix.cs" />
     <Compile Include="System\Net\Http\SocketsHttpHandler\CurrentUserIdentityProvider.Unix.cs" />
     <Compile Include="$(CommonPath)System\Net\Security\Unix\SafeDeleteNegoContext.cs"
              Link="Common\System\Net\Security\Unix\SafeDeleteNegoContext.cs" />
   </ItemGroup>
-  <ItemGroup Condition="('$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true') and '$(TargetsOSX)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetstvOS)' != 'true' and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition="'$(TargetsUnix)' == 'true' and '$(TargetsOSX)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetstvOS)' != 'true'">
     <Compile Include="System\Net\Http\SocketsHttpHandler\HttpNoProxy.cs" />
     <Compile Include="System\Net\Http\SocketsHttpHandler\SystemProxyInfo.Unix.cs" />
   </ItemGroup>
     <Compile Include="$(CommonPath)System\Threading\Tasks\TaskCompletionSourceWithCancellation.cs"
              Link="Common\System\Threading\Tasks\TaskCompletionSourceWithCancellation.cs" />
   </ItemGroup>
-  <ItemGroup Condition="('$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true') and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
     <Compile Include="$(CommonPath)System\StrongToWeakReference.cs"
              Link="Common\Interop\Unix\StrongToWeakReference.cs" />
     <Compile Include="$(CommonPath)System\Net\SecurityProtocol.cs"
     <Compile Include="$(CommonPath)System\Threading\Tasks\TaskToApm.cs"
              Link="Common\System\Threading\Tasks\TaskToApm.cs" />
   </ItemGroup>
-  <ItemGroup Condition="('$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true') and '$(TargetsOSX)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetstvOS)' != 'true' and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition="'$(TargetsUnix)' == 'true' and '$(TargetsOSX)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetstvOS)' != 'true'">
     <Compile Include="$(CommonPath)Interop\Unix\System.Security.Cryptography.Native\Interop.ASN1.cs"
              Link="Common\Interop\Unix\System.Security.Cryptography.Native\Interop.ASN1.cs" />
     <Compile Include="$(CommonPath)Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs"
     <Reference Include="System.Threading.Channels" />
     <Reference Include="System.IO.Compression.Brotli" />
   </ItemGroup>
-  <ItemGroup Condition="('$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true') and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
     <Reference Include="System.Console" Condition="'$(Configuration)' == 'Debug'" />
     <Reference Include="System.Diagnostics.StackTrace" />
     <Reference Include="System.IO.FileSystem" />
index d80006f..6df2437 100644 (file)
              Link="Common\System\HexConverter.cs" />
   </ItemGroup>
   <!-- Unix specific files -->
-  <ItemGroup Condition="'$(TargetsUnix)' == 'true' and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
     <Compile Include="$(CommonPath)System\Net\ContextAwareResult.Unix.cs"
              Link="Common\System\Net\ContextAwareResult.Unix.cs" />
     <Compile Include="$(CommonPath)System\Net\ContextFlagsAdapterPal.Unix.cs"
index ff314fe..a400ca5 100644 (file)
     <Reference Include="System.IO.FileSystem" />
     <Reference Include="System.Threading.Thread" />
   </ItemGroup>
-  <ItemGroup Condition="'$(TargetsLinux)' == 'true' or '$(TargetsBrowser)' == 'true' OR '$(TargetsFreeBSD)' == 'true'">
+  <ItemGroup Condition="'$(TargetsLinux)' == 'true' or '$(TargetsBrowser)' == 'true' or '$(TargetsFreeBSD)' == 'true'">
     <Reference Include="System.Threading.Timer" />
   </ItemGroup>
 </Project>
index 3fb17d6..e488bb8 100644 (file)
@@ -8,7 +8,6 @@ using System.Runtime.Caching;
 namespace System.Runtime.Caching.Tests
 {
     // These are the tests to fill in some of the coverage in ported Mono caching tests
-    [SkipOnMono("MemoryCache is not supported on Browser", TestPlatforms.Browser)]
     public class AdditionalCacheTests
     {
         [Fact]
index f077a14..43a1c20 100644 (file)
@@ -42,7 +42,6 @@ using MonoTests.Common;
 
 namespace MonoTests.System.Runtime.Caching
 {
-    [SkipOnMono("MemoryCache is not supported on Browser", TestPlatforms.Browser)]
     public class MemoryCacheTest
     {
         [Fact]
index 7b46386..1333394 100644 (file)
@@ -13,7 +13,7 @@
   <ItemGroup Condition="'$(TargetsBrowser)' == 'true'">
     <Compile Include="System\Runtime\InteropServices\RuntimeInformation\RuntimeInformation.Browser.cs" />
   </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' == 'true' and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
     <Compile Include="System\Runtime\InteropServices\RuntimeInformation\RuntimeInformation.Unix.cs" />
     <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.GetUnixName.cs"
              Link="Common\Interop\Unix\System.Native\Interop.GetUnixName.cs" />
index 94e6b72..edad8a8 100644 (file)
     <Compile Include="$(CommonPath)System\Security\Cryptography\RSACng.SignVerify.cs"
              Link="Common\System\Security\Cryptography\RSACng.SignVerify.cs" />
   </ItemGroup>
-  <ItemGroup Condition=" '$(TargetsUnix)' == 'true' and '$(TargetsOSX)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetstvOS)' != 'true' and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition=" '$(TargetsUnix)' == 'true' and '$(TargetsOSX)' != 'true' and '$(TargetsiOS)' != 'true' and '$(TargetstvOS)' != 'true'">
     <Compile Include="$(CommonPath)Interop\Unix\System.Security.Cryptography.Native\Interop.ASN1.cs"
              Link="Common\Interop\Unix\System.Security.Cryptography.Native\Interop.ASN1.cs" />
     <Compile Include="$(CommonPath)Interop\Unix\System.Security.Cryptography.Native\Interop.ASN1.Nid.cs"
     <Compile Include="Internal\Cryptography\TripleDesImplementation.OSX.cs" />
     <Compile Include="System\Security\Cryptography\ECDiffieHellman.Create.SecurityTransforms.cs" />
   </ItemGroup>
-  <ItemGroup Condition=" '$(TargetsUnix)' == 'true' and '$(TargetsBrowser)' != 'true'">
+  <ItemGroup Condition=" '$(TargetsUnix)' == 'true'">
     <Compile Include="$(CommonPath)Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Cipher.cs"
              Link="Common\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Cipher.cs" />
     <Compile Include="$(CommonPath)Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs"