What is the difference between an interface with default implementation and abstract class?
C# 8.0 has introduced a new language feature – default implementations of interface members. ``` public interface IRobot { void Talk(string message) { Debug.WriteLine(message); } ...
- Modified
- 26 Sep at 13:7
How to set hosting environment name for .NET Core console app using Generic Host (HostBuilder)
I am setting up a .NET Core 2.x console app as a Windows service and need to load an appsettings json file based on the environment. I was thinking to start the service with a command line argument t...
Formatting DateTime in ASP.NET Core 3.0 using System.Text.Json
I am migrating a web API from .NET Core 2.2 to 3.0 and want to use the new `System.Text.Json`. When using `Newtonsoft` I was able to format `DateTime` using the code below. How can I accomplish the ...
- Modified
- 26 Nov at 00:54
IHostBuilder does not contain a definition for ConfigureWebHostDefaults
I'm trying to use the new `GenericHost` in documented [here](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-3.0) but I'm getting a really basic error tha...
- Modified
- 11 Mar at 05:26
What's the difference between ASP.NET Core Hosted and Server-Side Blazor, really?
I'm still struggling to understand the difference between and Blazor. I know same question already [exists](https://stackoverflow.com/questions/53332097/blazor-asp-net-core-hosted-vs-server-side-in-...
- Modified
- 20 Jun at 09:12
How to pass a parameter to razor component in server-side Blazor?
How can I pass parameter into razor component? So far I tried ``` @(await Html.RenderComponentAsync<Rateplan>(RenderMode.ServerPrerendered, new { id= 100})) ``` But I receive an error > InvalidOp...
- Modified
- 14 Nov at 10:7
Identity asp.net core 3.0 - IdentityDbContext not found
My app broke with the 3.0 release of .NET core with reference errors for `IdentityDbContext`. I'm looking through documentation for Identity on core 3.0 but it implies that IdentityDbContext should b...
- Modified
- 25 Sep at 01:56
Self-hosted In Process Web API with Dot net core
I am trying to investigate the plausibility of moving to dot net core now 3.0 has been released. One of our key components allows our (private) nugets to create their own WebAPI, providing events and ...
- Modified
- 24 Sep at 20:27
Nullable Reference Types and the Options Pattern
How can we use in combination with the [Options pattern](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-3.0)? Let's say we have an options model nam...
- Modified
- 24 Sep at 19:28
Issues with swagger after migrating to .NET Core 3.0
After migrating to .NET Core 3.0. I'm having issues configuring swagger. Following is my configuration. Following is the exception > TypeLoadException: Could not load type > 'Microsoft.AspNetCore.Mvc...
- Modified
- 16 May at 18:33
How to get actual path to executable when using .netcore 3.0 and using the /p:PublishSingleFile=true flag?
I recently upgraded an application to dotnet core 3 and started using the PublishSingleFile flag during the build process. With these two changes the way the executable path is found has changed. Now ...
- Modified
- 24 Sep at 18:16
Citrix Netscaler block ServiceStack Server Events
I'm using Service Stack Server Event to push notification to the clients, but one customer need to host Server Stack apphost behind a Citrix Netscaler. In this scenario all connection seems to be abo...
- Modified
- 24 Sep at 08:48
Why are Blazor lifecycle methods getting executed twice?
So with a release of asp.net core 3.0 and blazor 1.0 I started doing some actual work with blazor. When splitting Blazor component code into code behind I am using the following ``` public class Logou...
- Modified
- 2 Sep at 17:28
EF Linq Error after change from dotnet Core 2.2.6 to 3.0.0
I'm trying to upgrade a solution to the new Core Framework 3.0.0. Now I'm having a small issue I don't understand. Look, this method was unproblematic in 2.2.6: ``` public async Task<IEnumerable<App...
- Modified
- 24 Sep at 07:9
Is polymorphic deserialization possible in System.Text.Json?
I try to migrate from Newtonsoft.Json to System.Text.Json. I want to deserialize abstract class. Newtonsoft.Json has TypeNameHandling for this. Is there any way to deserialize abstract class via Syste...
- Modified
- 23 Nov at 19:26
"The response ended prematurely" when connecting to insecure gRPC channel
I'm trying to establish a connection to an insecure gRPC server. I'm using gRPC for communication between two processes inside of a Docker container, that's why I don't need any encryption or strong a...
Can I remove the "highlighting" in a razor file in Visual Studio?
I wanted to try out blazor and mess around with it and make some stuff for testing. I really like it, but the only thing that really annoys me is the highlighting of sequences in the razor file, where...
- Modified
- 21 Sep at 19:12
DefaultIfEmpty().Max() still throws 'Sequence contains no elements.'
After I updated my project to dotnet core 3.0RC1 (might be in preview9 as well) my code that used to work ``` var value = context.Products.Where(t => t.CategoryId == catId).Select(t => t.Version).De...
- Modified
- 21 Sep at 13:36
Not awaiting an async call is still async, right?
I'm sorry if this is a silly question (or a duplicate). I have a function `A`: ``` public async Task<int> A(/* some parameters */) { var result = await SomeOtherFuncAsync(/* some other parameter...
- Modified
- 20 Sep at 22:2
How to get device token in iOS 13 with Xamarin?
Our RegisteredForRemoteNotifications code broke because the token was retrieved with: ``` deviceToken.ToString().Trim('<').Trim('>').Replace(" ", ""); ``` This used to work but not with iOS 13 beca...
- Modified
- 20 Sep at 11:38
Visual Studio debugging stop immediately on file upload in mvc?
So I'm trying to get into .NET Core MVC using Visual Studio 2019 Enterprise. I tried to follow a fairly simple example from Microsofts own [documentation](https://learn.microsoft.com/en-us/aspnet/cor...
- Modified
- 23 Sep at 08:40
How do you use Basic Authentication with System.Net.Http.HttpClient?
I'm trying to implement a rest client in c# .net core that needs to first do Basic Authentication, then leverage a Bearer token in subsequent requests. When I try to do Basic Authentication in combi...
- Modified
- 19 Sep at 15:51
Microsoft.Extensions.Logging - LogError is not logging exception
I'm using the simple `ASP.NET` provided logger that I get via dependency injection: `Microsoft.Extensions.Logging.ILogger<T>`. In practice the dynamic type is `Microsoft.Extensions.Logging.Logger<T>`....
- Modified
- 19 Sep at 12:28
No definition found for GetActiveObject from System.Runtime.InteropServices.Marshal C#
I'm trying to connect to a running Excel instance, but when I try to use the following code snippet: ``` using Microsoft.Office.Interop.Excel; using System.Runtime.InteropServices; public Applicatio...
dotnet core System.Text.Json unescape unicode string
Using `JsonSerializer.Serialize(obj)` will produce an escaped string, but I want the unescaped version. For example: ``` using System; using System.Text.Json; public class Program { public static...
- Modified
- 28 Sep at 02:6