dotnet-core/release-notes/5.0/5.0-known-issues.md
2020-11-10 07:00:50 -08:00

19 KiB
Raw Blame History

.NET 5 Known Issues

This document lists known issues for .NET 5 Preview 1 and beyond releases which may be encountered during usage.

.NET Runtime

Preview 1

  1. Certain regular expressions involving negated character classes may fail to match correctly. This was a regression that occurred during extensive performance improvements made to the regular expression engine in 5.0. There is no general workaround, but modifying the expression may avoid the problem. This will be fixed in Preview 2. The issue dotnet/runtime #33399 explains the bug in detail.

  2. Stepping with the debugger into code in certain assemblies in the .NET Platform may not succeed. This is because the assemblies do not have correct SourceLink information. This will be fixed in Preview 2. It is tracked by dotnet/runtime #33097.

  3. The Microsoft.Windows.Compatibility package references dependencies that are not available at the targeted versions. To workaround, individually reference the packages your project needs. It is tracked by dotnet/runtime/issues #34351

Preview 2

  1. The Microsoft.Windows.Compatibility package references dependencies that are not available at the targeted versions. To workaround, individually reference the packages your project needs. It is tracked by dotnet/runtime/issues #34351

Preview 4

.NET 5.0 on Windows 10 May 2019 Update and later versions depends on ICU library for the Globalization:

  • The returned value of System.Globalization.TextInfo.ListSeparator can return different values than it used to return. Also, sometimes can return empty string. https://github.com/dotnet/runtime/issues/43795
  • string.IndexOf(string), string.EndsWith(string), string.StartsWith(string), string.LastIndexOf(string), and string culture-aware comparisons can return different results for some inputs. dotnet/runtime#43736. We're thinking and discussing how to mitigate this long term, dotnet/runtime#43956.

Please read the following docs to see the motivation behind the change, workarounds and more information about how you can encounter these breaks and mitigate them: - .NET globalization and ICU - Behavior changes when comparing strings on .NET5+ - [Globalization breaking changes](https://docs.microsoft.com/dotnet/core/compatibility/globalization

Preview 6

  1. With the work to provide sustainable and long-term support for WinRT consumption in .NET, the built-in support has been removed. This is a high impact change to all existing libraries and application that rely on the built-in WinRT support. The replacement for built-in WinRT support is the C#/WinRT tool chain. For complete details, see the official doc issue at dotnet/docs#18875.

GA

  1. When reading from a NegotiateStream at EOF, the stream will throw rather than return 0 or -1. This will be fixed in 5.0.1. It is tracked by dotnet/runtime/pr #43741.

ASP.NET Core Runtime

Preview 4

  1. When running a docker enabled application from Visual Studio or running dotnet dev-certs https --trust -ep <<path.pfx>> -p <<password>> the HTTPS certificate created by ASP.NET Core will become corrupted and will prevent applications from running. If you try to run the dotnet dev-certs tool again it will think that there is no valid certificate and will try to recreate a new one every time it runs. To avoid this situation, you can add a global.json file at the root of your project and set it to use the latest 3.1.xxx installed sdk. If you tried to run the application within Visual Studio and it corrupted the certificate you will have to clean the existing certificates from your certificate store using the windows tooling. To do that, open the certificate manager (Windows+R -> certmgr.msc) and delete all the certificates that contain the "ASP.NET Core HTTPS development certificate" image and also remove them from Trusted Root Certification Authorities We recommend to not create / open any docker-enabled projects while on Preview 4 SDK.

This will be fixed in the Preview 5 release. It is tracked by dotnet/aspnetcore/issues #21733

This issue has been resolved by https://github.com/dotnet/runtime/pull/36312

Preview 5

  1. On Windows ARM64, NodeServices and SpaServices dont work, because NodeJS is not supported on Windows ARM64. We will look into supporting these features once NodeJS releases support for Windows ARM64.

Preview 7

Some regular expressions will not match when using RegexOptions.Compiled and RegexOptions.IgnoreCase together

In some cases, a regular expression will fail to match when using RegexOptions.Compiled and RegexOptions.IgnoreCase together. This can occur when the pattern begins with a literal prefix (a sequence of characters that are not special regular expression tokens) whose last character is not affected by casing changes (for example, a symbol character).

The workaround is to remove "RegexOptions.Compiled", which will run a little slower but will avoid the bug. This problem is fixed in Preview 8. More details are in this issue: https://github.com/dotnet/runtime/issues/39518

Preview 8

Scaffolding

After installing Visual Studio 16.8 Preview 2, for ASP.NET Core projects targeting .NET 5 scaffolding will result in an error. The error that appears after attempting to use Add New Scaffolded Item is Install the package Microsoft.VisuaIStudio.Web.CodeGeneration.Design and try again.

Workaround:

The dotnet aspnet-codegenerator command line utility can be used. You can find more info on how to use the command line scaffolder at dotnet aspnet-codegenerator.

This issue was resolved in 5.0 RC2.

Templates

Known issue with the Azure B2C authentication web app password reset scenario not working.

Workaround:

Add the token cache implementation in startup.cs:

services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
             .AddMicrosoftWebApp(Configuration, "AzureAdB2C")
             .AddMicrosoftWebAppCallsWebApi(Configuration, "AzureAdB2C")
             .AddInMemoryTokenCaches();

and then in appsettings.json, include a client secret.

Known issue with Register/Log in button not working when confirming email for a new user in Blazor Server apps with Individual User Accounts

Workaround:

Edit Areas\Identity\Pages\Shared_LoginPartial.cshtml in the project and change all instances of asp-area="MicrosoftIdentity" to asp-area="Identity"

- <a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-page="/Account/Register">Register</a>
+ <a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register</a>

RC1

Authentication using Identity Server does not work when applications are published as single file applications

Problem:

Applications that use Identity Server 4 will throw exceptions when published as a single file application. This includes applications generated from Blazor templates which include authentication for in-application, individual accounts.

Workaround:

Do not publish applications which include Identity Server as single file applications.

TcpListener throwing SocketException instead of ObjectDisposedException

Problem:

When calling Stop after BeginAcceptSocket or BeginAcceptTcpClient on a TcpListener instance, a subsequent EndAcceptSocket or EndAcceptTcpClient call will throw SocketException with SocketError.OperationAborted (995) instead of ObjectDisposedException: https://github.com/dotnet/runtime/issues/41585

Workaround:

If you're using APM Accept metods on TcpClient, change the catch block (temporarily), when updating to RC1:

try
{
    Socket client = listener.EndAcceptSocket(ar);
}
catch (ObjectDisposedException ex)
{
    // Original exception handler -- won't be invoked in RC1
    HandleListenerStopped(listener);
}
+catch (SocketException ex) when (ex.SocketErrorCode == SocketError.OperationAborted)
+{
+    // This handler will be hit in RC1, but not in subsequent releases,
+    // so it could be removed starting from RC2.
+    HandleListenerStopped(listener);
+}

Blazor Virtualization component limitations

Issues resolved in 5.0 RC2 by https://github.com/dotnet/aspnetcore/pull/25260.

The Virtualization component is new in RC1 and there are some fixes we didn't fit in RC1, which make the component unusable for certain scenarios.

  1. Item size calculations can be wrong by a subpixel amount, which accumulates and produces offsets in scrolling when the source list goes beyond several pages.
  2. When items don't have @key, scrolling can get stuck in a loop.

All these limitations are addressed in the RC2 release

.NET SDK

Preview 1

  1. Resolved -- Runtime-dependent deployments of apps targeting .NET Core 3.1 that are created with .NET Core SDK 5.0.100 Preview 1 will require version 3.1.2 of the .NET Core runtime. This issue is tracked by dotnet/sdk #10812

Preview 5

  1. Resolved -- For self-contained single-file apps, hostfxr and hostpolicy are not bundled into the application bundle, but are published alongside it. Framework-dependent single-file apps are not affected (since hostfxr and hostpolicy reside within the framework). This issue should be resolved in Preview 6, tracked by dotnet/runtime #32823.

Preview 8

  1. (Fixed in RC1, affects only Preview 8 and RC1 before 5.0.100-rc.1.20451.10) Running xUnit tests fails to discover tests in with message No test is available in <assembly> Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.. To solve this update your xunit.runner.visualstudio package to version 2.4.3. This version is used in dotnet new templates, but existing projects targetting, or updating to net5.0 need to be updated manually.

  2. Resolved -- Projects targeting net5.0-windows will fail to build if the TargetPlatformMinimumVersion does not match the TargetPlatformVersion

    • An error similar to the following will be generated:

    NETSDK1005: Assets file 'C:\Users\username\source\repos\project\NuGetPackageExplorer-main\NuGetPackageExplorer-main\Types\obj\project.assets.json' doesn't have a target for 'net5.0-windows10.0.18362'. Ensure that restore has run and that you have included 'net5.0-windows10.0.18362' in the TargetFrameworks for your project.

  3. Resolved -- C++/CLI

    • C++/CLI projects will not build if targeted to .NET 5.0
  4. Resolved -- Warning icons in Dependencies node in Solution Explorer

    • For projects targeting .NET 5, warning icons may be displayed on packages listed in the Solution Explorer Depdendencies node

RC1

  1. Libraries targeting net5-windows that were compiled with preview 8 will need to be recompiled. This is because they have an assembly-level MinimumOSPlatformAttribute defined, which was renamed to SupportedOSPlatformAttribute in RC1. Reflecting over the assembly with the old attribute can fail. For WPF projects, this can surface as a failure in the MarkupCompilePass1 target:

C:\Program Files\dotnet\sdk\5.0.100-rc.1.20453.4\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets(240,9): error MC1000: Unknown build error, 'Could not find type 'System.Runtime.Versioning.MinimumOSPlatformAttribute' in assembly 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0-rc.1.20452.14\ref\net5.0\System.Runtime.dll'.'

- MinimumOSPlatformAttribute was renamed to SupportedOSPlatformAttribute
- RemovedInOSPlatformAttribute was renamed to UnsupportedOSPlatformAttribute
- ObsoletedInOSPlatformAttribute was removed.
  1. Resolved -- Warning icons in Dependencies node in Solution Explorer
    • For projects targeting .NET 5 where there's a package downgrade error, warning icons won't be displayed on the error message's ancestor nodes (such as the package node, the "Packages" node, and the "Dependencies" node) in the Solution Explorer
  2. Resolved -- Restore of F# project with TargetFrameworks and /p:RestoreUseStaticGraphEvaluation=true will fail with NuGet.RestoreEx.targets(10,5): error : Invalid restore input. Invalid target framework 'unsupported'.
    • Workaround: Add the following block to your fsproj file:

      <PropertyGroup>
          <InnerBuildProperty>TargetFramework</InnerBuildProperty>
          <InnerBuildPropertyValues>TargetFrameworks</InnerBuildPropertyValues>
      </PropertyGroup>
      
  3. Resolved -- When launching Blazor apps from VS or initializing a debugging session in the browser, port 9300 must be open on the machine the Blazor app is running under.

RC2

  1. For Windows Application Packaging projects targeting net5.0, we recommend targeting the Windows SDK 19041. This Windows SDK is not installed by default in the Visual Studio installer options though is available and an Optional component.
    • You might see build error APPX3217: SDK folder containing 'UAP.props' for 'UAP 10.0.19041.0' could not be located.
  2. Dotnet tool pack does not support the new net5.0 framework alias. Please continue to target netcoreapp3.1 for now for WPF or Winforms dotnet tools. See https://github.com/dotnet/sdk/pull/13924
  3. Resolved -- Dotnet tool pack does not support the new net5.0 framework alias. Please continue to target netcoreapp3.1 for now for WPF or Winforms dotnet tools. See https://github.com/dotnet/sdk/pull/13924
  4. Resolved -- Publishing with ReadyToRunUseCrossgen2 fails with an An assembly specified in the application dependencies manifest (crossgen2.deps.json) was not found error.

GA

  1. New Angular templates created via the dotnet new CLI or the new project UI in VS may fail to build on the command line due to an issue with the node-gyp install. To workaround this issue, upgrade the version of the node-sass dependency in ClientApp/package.json to 5.0.0.

  2. When creating a new C# desktop application in Visual Studio 2019 version 16.8 (including Console App, Windows Forms App, or WPF App), the project will default to targeting the latest LTS SDK that is installed (e.g. .NET Core 3.1). To create a new .NET 5 project, you can either use the CLI, or create a new project in Visual Studio and immediately retarget to .NET 5 in the project properties. When you retarget from 3.1 to .NET 5.0, it is no longer necessary to append .WindowsDestkop to the SDK reference. Consider changing Microsoft.NET.Sdk.WindowsDesktop to just Microsoft.NET.Sdk. You can also modify this behavior by enabling the Visual Studio preview feature: "Show all .NET Core templates in the New Project dialog".

  3. Design time build failure and dependency node warning icons when targeting netcoreapp2.1 and specifying a RuntimeIdentifier in the project file. This is the default for Service Fabric projects.

Error experience

Project is targeting runtime 'win7-x64' but did not resolve any runtime-specific packages for the 'Microsoft.NETCore.App' package. This runtime may not be supported by .NET Core.

Workaround

Add a Directory.Build.Targets file with the following content

<Project>
  <Target Name="EnsureNETCoreAppRuntime" />
</Project>
  1. dotnet new -i for a template uses NuGet restore to download the template package and this requires a TargetFramework. The template engine defaults to netcoreapp1.0 to restore the template. This will trigger warning NETSDK1138 as that target framework is no longer supported but has no negative affect on the template download.

MSBuild

RC2

In .NET 5.0 preview 7 through RC1, projects that target net5.0 define both NETCOREAPP3_1 and NET5_0 preprocessor symbols. The intent behind this behavior change was that starting with .NET 5.0, conditional compilation symbols would be cumulative.

In .NET 5.0 RC2 and later, projects only define symbols for the target framework monikers (TFM) that it targets and not for any earlier versions.

Visit MSBuild breaking change for more details.

Windows Forms

Preview 6

  • TreeNode.ImageIndex and TreeNode.SelectedImageIndex cannot be set to "(none)" (represented by the magic number -2).

    image

    There is no known workaround. The issue is expected to be fixed in 5.0.1.

Preview 7

  • Application.EnableVisualStyles() does not enable Visual Styles when the application is published as 'Self-contained' + 'Produce Single File'. The manifest that enables Visual Styles is loaded from a native resource in System.Windows.Forms.dll, however in single file mode there is no "dll" to load from so this feature is not working as intended.

    The only practical workaround is to add a manifest file to your project and enable the 6.0 common controls section. Uncomment this section after adding a manifest item to your project:

      <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
      <dependency>
        <dependentAssembly>
          <assemblyIdentity
              type="win32"
              name="Microsoft.Windows.Common-Controls"
              version="6.0.0.0"
              processorArchitecture="*"
              publicKeyToken="6595b64144ccf1df"
              language="*"
            />
        </dependentAssembly>
      </dependency>
    

    The issue is expected to be fixed in 5.0.1.

RC1

  • Changes at runtime to an instance of an ImageList which is already bound to a control (such as a ListView or a TreeView) won't be reflected in the control until the instance of the ImageList is re-assigned to the said control.

    • Workaround: after changes to an instance of a ImageList unbind it from a control, and bind back:

      imageList.Images.Add(image);
      
      listView1.LargeImageList = null;      // unbind
      listView1.LargeImageList = imageList; // bind back
      

    The issue is expected to be fixed in 5.0.1.