How to use new c# 8.0 features in Razor views
I've updated my ASP.NET Mvc 5 web application to use the new c# 8.0 features through Visual Studio 2019 and everything works fine until I try to use these new features inside a Razor view. For exampl...
- Modified
- 7 Nov at 14:49
Why declare a local function static in C# 8.0
In C# 8.0, [Static Local Functions are announced](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-8#static-local-functions) Can anyone help enlighten me as to why you would want to d...
- Modified
- 7 Nov at 09:36
C# Switch expressions returning different result
I've switched to C# 8 on one of my projects. And I've been moving all of my `switch` statements to expressions. However I found out that my project started working differently and I've found out that ...
- Modified
- 7 Nov at 07:14
ImmutableSortedDictionary range enumeration by key
I was reading about C#'s `ImmutableSortedDictionary` in `System.Collections.Immutable` and thinking about how to apply it in my program. I quite like C++'s `lower_bound` and `upper_bound` (see [here](...
- Modified
- 14 Nov at 01:8
Identity Server 404 after login (stuck on signin-oidc)
I followed the Identity Server 4 documentation to set up an example server on my local machine. My problem is, that after I log in the application gets stuck on "signin-oidc" page and the logs indicat...
- Modified
- 6 Nov at 23:34
Form view designer is not working in Visual Studio 2019 with C# .NET Core 3.1
When I am opening a Visual Studio project with VB.NET then the Form view designer is automatically opened, but when I open a new project with C# .NET Core 3.1 with Windows Forms then it is showing cod...
- Modified
- 8 May at 16:32
ServiceStack - Year, Month, and Day parameters describe an un-representable DateTime even using JsConfig
I have looked at multiple resources online, but whatever I try just doesn't seem to work. What am I doing wrong? using directives ``` using ServiceStack; using ServiceStack.Text; using System; using...
- Modified
- 6 Nov at 08:51
Blazor - show confirmation dialog before delete/update?
In the following Blazor (server-side) code snips. How to prompt the confirmation dialog? ``` <tbody> @foreach (var r in lists) { var s = r.ID; <tr> <td>@s</td> ...
How to import Microsoft.AspNetCore.Hosting.IWebHostEnvironment?
The following code in my project gets the following error. ``` public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration, Microsoft.AspNe...
- Modified
- 4 Nov at 22:12
Proper way to use DisposeAsync on C# streams
I'm writing a method which asynchronously writes separate lines of text to a file. If it's it deletes the created file and jumps out of the loop. This is the simplified code which works fine... And I...
- Modified
- 9 Jul at 19:32
System.Text.Json Merge two objects
Is it possible to merge two json objects like this with `System.Text.Json?` **Object 1** ```js { id: 1 william: "shakespeare" } ``` **Object 2** ```js { william: "dafoe" ...
- Modified
- 2 May at 11:2
What memory model is implemented in .NET Core?
The ECMA CLI specification defines a weak memory model. This allows to reorder the command execution order (which is useful for performance). But writing low-level code for such a model is very diffic...
Handle change on Autocomplete Component from material ui
I want to use `Autocomplete` component for input tags. I'm trying to get the tags and save them on a state so I can later save them on the database. I'm using functions instead of classes in react. I ...
- Modified
- 23 Aug at 10:12
How do I enable http2 in C# Kestrel web server over plain http?
How do I (and is it possible) to enable http2 over plain http in the C# Kestrel web server? All Microsoft documentation indicates that https/TLS is required, but I have services that will be running b...
Nullability of reference types in return type doesn't match overridden member
I'm using an API that returns JSON where one of its values can be either `false` or an object. To handle that, I've created a custom [`JsonConverter`](https://learn.microsoft.com/en-us/dotnet/api/syst...
- Modified
- 28 Aug at 03:11
Nullable reference type information not exposed from FirstOrDefault
I wanted to test out the new [nullable reference types](https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references) feature in C# 8.0. I started a new project targeting .NET Core 3.0, enable...
- Modified
- 10 Apr at 21:26
'propertyName' cannot be used as a property on entity type 'typeName' because it is configured as a navigation
I have an entity `user` with the following: ``` public class User { [Key, Required] public int Id { get; set; } public int GenderId { get; set; } public virtual Gender Gender { get; s...
- Modified
- 1 Nov at 13:45
Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler
I have a framework (in this instance it's RxSwift) which I've compiled using Xcode 11.0 into the traditional `RxSwift.framework` style package This imported fine into Xcode 11.0 and also 11.1 never h...
consume JSON from webhook in C#
Hi I'm looking to create a simple webhook receiver and dump the data into a table. This is for receiving SMS using Zipwhip. Zipwhip will send a post with JSON. Need to receive the JSON and process. ...
- Modified
- 31 Oct at 19:10
Can I combine a gRPC and webapi app into a .NET Core 3.0 in C#?
I am using dot net core 3.0. I have gRPC app. I am able to communicate to it through gRPC protocol. I thought my next step would be add some restful API support. I modified my startup class to add c...
403 Message: Legacy People API has not been used in project
Google API is active but give error ; Legacy People API has not been used in project before or it is disabled. Enable it by visiting [https://console.developers.google.com/apis/api/legacypeople.googl...
- Modified
- 1 Nov at 19:43
How to differentiate between null and non existing data in JSON in Asp.Net Core model binding?
I want to differentiate between these two json inputs in an action in Asp.Net Core: ``` { "field1": null, "field2": null } ``` and ``` { "field1": null, } ``` I have an ordinary class lik...
- Modified
- 31 Oct at 13:47
Errors when trying to use StackExchange REDIS in Azure Cloud Service Worker Role
I have a solution hosted in Azure that is using ServiceStack.Redis 2.0.601. App Services (Web API) and On-Premise windows services are all working as expected but the Cloud service worker roles are th...
- Modified
- 31 Oct at 12:16
EF Core 3.0 translating string.Equals ordinalIgnoreCase correctly
Before EF Core 3.0 this worked fine (evaluated on server+client): ``` var exists = await _context.Countries.AsNoTracking().AnyAsync(x => x.CountryCode.Equals(country.CountryCode, StringComparison.Ord...
- Modified
- 31 Oct at 10:23
How to redirect to a post upon authentication in ServiceStack
Maybe I am trying to do something stupid but... I am attempting to build a ServiceStack OAuth Provide for Azure AD. The redirect URI is passed through by the SS Authentication but I am not sure what...
- Modified
- 31 Oct at 03:5