Using Linq’s Where/Select to filter out null and convert the type to non-nullable cannot be made into an extension method

You have to update your extension method to the following public static IEnumerable<T> NotNull<T>(this IEnumerable<T?> enumerable) where T : class { return enumerable.Where(e => e != null).Select(e => e!); } The point here is that you are converting the IEnumerable of nullable references to not nullable ones, therefore you’ll have to use IEnumerable<T?>. where T … Read more

Unable to bind to http://localhost:5000 on the IPv6 loopback interface: ‘Cannot assign requested address’

To workaround the issue, add the code ENV ASPNETCORE_URLS=http://+:80 below the other ENV declarations at the top of the Dockerfile.develop file Dockerfile.develop after: FROM mcr.microsoft.com/dotnet/core/sdk:3.1 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true ENV ASPNETCORE_URLS=http://+:80 EXPOSE 80 Explanation Server URLs is one of the ASP.NET Core Web Host configuration values. It uses the environment variable ASPNETCORE_URLS and … Read more

Create empty IAsyncEnumerable

If you install the System.Linq.Async package, you should be able to use AsyncEnumable.Empty<string>(). Here’s a complete example: using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; class Program { static async Task Main() { IAsyncEnumerable<string> empty = AsyncEnumerable.Empty<string>(); var count = await empty.CountAsync(); Console.WriteLine(count); // Prints 0 } }

Linq methods for IAsyncEnumerable

LINQ for IAsyncEnumerable is supported by System.Linq.Async which is part of the reactive extensions for .NET. The reactive extensions as a whole are split into two larger NuGet packages: System.Reactive and System.Interactive. While all the packages stayed the same, the extensions now live in the System.Linq namespace, not System.Linq.Async anymore (thanks Dzmitry Lahoda). Relevant GitHub … Read more

How can I hint the C# 8.0 nullable reference system that a property is initalized using reflection

Whenever you want to tell the compiler “shut up, I know what I’m doing” in regards to nullable reference types, use the ! operator. You can fix your issue by declaring your properties like so: public DbSet<Probe> Probes { get; set; } = null!; public DbSet<ProbeUnitTest> ProbeUnitTests { get; set; } = null!;

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)