Questions

Why is an explicit `this` constructor initializer required in records with a primary constructor?

In C# 9 we can create positional records causing them to get a constructor, which the spec draft calls a [primary constructor](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/propos...

13 Dec at 01:49

xlrd.biffh.XLRDError: Excel xlsx file; not supported

I am trying to read a macro-enabled Excel worksheet using `pandas.read_excel` with the xlrd library. It's running fine in local, but when I try to push the same into PCF, I am getting this error: ``` ...

8 Feb at 14:50

How can I use .NET Core in C# interactive?

How can I make the C# interactive console inside Visual Studio use .NET Core instead of .NET Framework? By default when it starts it shows that it is using .NET Framework in parenthesis in the title b...

c# 9.0 covariant return types and interfaces

I have two code examples: One compiles ``` class C { public virtual object Method2() => throw new NotImplementedException(); } class D : C { public override string Method2() =...

2 Mar at 10:34

System.Net.HttpStatusCode not generating on DTO

In several of my models I am storing the System.Net.HttpStatusCode like so: ``` public HttpStatusCode HttpStatusCode { get; set; } ``` When generating DTO file with SS typescript service, enums that ...

9 Dec at 17:49

JsonPropertyNameAttribute is not supported record from C#9?

I want to use record with JsonPropertyName attribute, but it caused an error. This is not supported? Any workaround? ``` public record QuoteResponse([JsonPropertyName("quotes")] IReadOnlyCollection<Qu...

9 Dec at 15:18

Microsoft Visual Studio 2019: The project file cannot be opened. Unable to locate the .NET SDK

I just upgraded my visual studio to latest version and suddenly I am not able to load any C# project and getting the following error for all .NET core projects: > The project file cannot be opened. ...

ServiceStack (5.5.0) - When testing a ServiceStackController Gateway is null and throws an exception

Using ServiceStack (v 5.5.0) I read the recommended approach to calling services via a controller is by using the Gateway. Full example is found at [https://github.com/RhysWilliams647/ServiceStackCont...

8 Dec at 15:48

Issue with scaffolding a MySql database with EF Core - Method not found: Void Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping

I'm trying to scaffold a MySql Database code first using `MySql.Data.EntityFrameworkCore` and `Microsoft.EntityFrameworkCore` on .NET Core 3.1 in Visual Studio 2019. However, I keep getting the follow...

.Net 5 Publish Single File - Produces exe and dlls

I am using VS 2019 and .Net 5 to build a simple console application. I wanted to share this app with a friend so I tried to publish it as a single file but I keep getting some extra DLLs that the exec...

6 Dec at 16:23

How to implement Authorization Code with PKCE for Spotify

Getting the authorization is code is working as expected, but the step of exchanging the authorization code for tokens is failing. I am trying to implement the authorization code with PKCE flow for au...

5 May at 12:46

How to set the next/image component to 100% height

I have a Next.js app, and I need an image that fills the full height of its container while automatically deciding its width based on its aspect ratio. I have tried the following: ``` <Image src="...

ServiceStack Messaging API: Using HostContet.AppHost.ExecuteMessage in OnAfterInit gives NullReferenceException

As previously [discussed here](https://stackoverflow.com/questions/64562749/servicestack-reinstate-pipeline-when-invoking-a-service-manually), I am sometimes using this approach to execute Services in...

4 Dec at 16:33

Converting int to int? possible update?

I built my project locally and it worked with a code similar to the following: ``` bool success = true; int y = 0; int? x = success ? y : null; ``` But our build machine failed with the following err...

3 Dec at 19:32

How do I define the SignedOut page in Microsoft.Identity.Web?

I'm successfully signing in and out using Azure AD B2C in a Blazor Server app, but it's not clear to me the proper way to define the SignedOut page. This question seems to be more applicable to , beca...

How to get file from Azure storage blob in a ByteArray format using Azure.Storage.Blobs in C#

I have a requirement to get the files from Azure storage in the byte array format using new package Azure.Storage.Blobs. I am unable to find the way to do it in a C#. ``` public byte[] GetFileFromAzur...

Defining a property in a record twice

In C# 9, one can define a property with the same name in a record both in its primary constructor and in its body: ``` record Cat(int PawCount) { public int PawCount { get; init; } } ``` This cod...

2 Dec at 15:0

How to get values from appsettings.json in a console application using .NET Core?

i'm creating a console application using .NET Core 3.1 and i would like to have an appsettings json to load all environment, paths, variables,... at the beginning of the execution, and then get values...

2 Dec at 20:50

Servicestack Ormlite generates invalid SQL query for custom select

I am using version 4.5.14 of Servicestack ormlite here "InMaintenance" Property is ignored as it is not the "Network" table column in the database. I want to set the value of the InMaintenance prope...

16 Feb at 06:34

Type Load Exception in EF Core Project

I have an ASP.NET Core 3.1 Web API application using EF Core. This is the my configuration in the `ConfigureServices` method of the `Startup` class: ``` services.AddDbContext<ApplicationContext>(optio...

13 Sep at 23:33

Warning CS7022 - The entry point of the program is global code; ignoring 'Program.Main(string[])' entry point

so I have an issue where I have this warning in my Error List: Severity Code Description Project File Line Suppression State Warning CS7022 The entry point of the program is global code; ...

28 Nov at 15:41

Entity Framework Core Many to Many change navigation property names

I have a table called "LogBookSystemUsers" and I want to setup many to many functionality in EF Core 5. I almost have it working but the problem is my ID columns are named `SystemUserId` and `LogBookI...

System.Text.Json Field Serialization in .NET 5 not shown in Swashbuckle API Definition

# Problem I'm using ASP.NET Core with .NET 5 and am using the `System.Text.Json` serializer to serialize types containing fields (like `System.Numerics.Vector3` (X, Y and Z are fields), although an...

NETSDK1135 SupportedOSPlatformVersion 10.0.19041.0 cannot be higher than TargetPlatformVersion 7.0

I am trying to convert a .NET Framework WPF app to .NET 5 I ran [https://github.com/dotnet/try-convert](https://github.com/dotnet/try-convert), and removed some incompatible DLL refs. Now, when I try ...

26 Nov at 21:18

How to deserialize an empty string to a null value for all `Nullable<T>` value types using System.Text.Json?

In .Net Core 3.1 and using `System.Text.Json` library, I'm facing an issue that didn't occur in Newtonsoft library. If I send an empty string in JSON for some properties of type (type in backend) `Dat...

25 Mar at 14:51