Questions

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 ...

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...

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-...

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...

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...

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 ...

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...

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...

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 ...

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...

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...

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...

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...

"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...

22 Sep at 19:9

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...

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...

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...

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...

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...

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...

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>`....

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...

19 Sep at 12:59

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...

Why is ClaimTypes.NameIdentifier not mapping to 'sub'?

Using ASP.NET Core 2.2 and Identity Server 4 I have the following controller: ``` [HttpGet("posts"), Authorize] public async Task<IActionResult> GetPosts() { var authenticated = this.User.Identity...

What is the fastest way to do Array Table Lookup with an Integer Index?

I have a video processing application that moves a lot of data. To speed things up, I have made a lookup table, as many calculations in essence only need to be calculated one time and can be reused....

19 Sep at 02:21