dotnet restore incredibly slow inside docker-compose build

I have a .NET Core project that I'm building into a docker image. The Dockerfile looks like this: ``` FROM mcr.microsoft.com/dotnet/core/sdk:3.0-alpine AS restore WORKDIR /tmp/build COPY ./*.sln . CO...

27 Aug at 07:15

AddNewtonsoftJson is not overriding System.Text.Json

I have upgraded my version of .Net Core from preview 2 to preview 6 which has broken a couple of things. Most significant is that I cannot use newtonsoft JSON anymore. AddNewtonsoftJson in ConfigureS...

Calling WEB API with basic authentication in C#

I have a working WEB API that I wrote, and I added basic authentication to the API (username is "testing", password is "123456"). However, when trying to call that API from my web form, I keep getting...

StackExchange.Redis.RedisTimeoutException: Timeout awaiting response

I have a Redis cluster of 6 instances, 3 master and 3 slaves. My ASP .NET Core application uses it as a cache. Sometimes I get such an error: `StackExchange.Redis.RedisTimeoutException: Timeout awaiti...

Does Dbcontext registered as "scoped" or "transient" affect in closing database connection

I have a basic understanding in DI in ASP.NET MVC, but there is a question that bothers me a lot. Does it make any difference to register Dbcontext as 'scoped' or "transient"? Below is some code of a...

23 Feb at 17:57

Manual controller registration in ASP.NET Core dependency injection

I need to override ASP.NET Core's default registration for a certain controller. I've tried the below, but it resolves `MyController` from the automatic registration. ``` services.AddTransient((prov...

25 Aug at 15:39

.NET Core EF, cleaning up SqlConnection.CreateCommand

I am using .NET Core DI to get `DbContext` and in my logic I need to execute raw SQL commands also on DB, so for that purpose I am creating `DbCommand` to execute SQL like this(just an example query, ...

BirthDate and BirthDateRaw not set on user registration

I have a form that handles user registration by sending data to the default route of `~/api/register`, but it doesn't work for BirthDate and neither for BirthDateRaw (mapped respectively as `DateTime?...

Blazor: Adding a custom AuthenticationStateProvider in Startup.cs not recognized

I am trying to implement a login using a custom database. As far as I can tell, I need to override AuthenticationStateProvider in order to accomplish this. In MyServerAuthenticationStateProvider.cs: ...

24 Aug at 16:8

The JSON value could not be converted to System.Int32

I want to send data of object to my Web API. The API accepts a parameter of class, which properties are type of int and string. This is my class: ``` public class deneme { public int ID { get; set;...

26 Aug at 16:5

Unable to merge 2 PDFs using MemoryStream

I have a c# class that takes an HTML and converts it to PDF using wkhtmltopdf. As you will see below, I am generating 3 PDFs - Landscape, Portrait, and combined of the two. The `properties` object con...

23 Aug at 13:17

IOptions binding with non-matching property names

Is is possible to bind properties from a JSON file (appsettings.json) to a class that uses different property names? I want to take the `WebURL` setting and map it to the `Url` property in the option...

6 May at 06:5

Integration testing .NET Code 2.2 IHostBuilder (Generic Host Builder)

I am using .NET Core 2.2 IHostBuilder (Generic Host Builder) to build a console app running message streaming app as a BackgroundService (IHostedService). [https://learn.microsoft.com/en-us/aspnet/co...

25 Aug at 23:54

Rounding of last digit changes after Windows .NET update

After Windows has updated, some calculated values have changed in the last digit, e.g. from -0.0776529085243926 to -0.0776529085243925. The change is always down by one and both even and odd numbers a...

21 Aug at 17:57

Why ASP Net Core 2.2 do not release memory?

I'm testing ASP Net Core 2.2 using default project made from: Visual Studio > File > New > Project > ASP NET Core Web Application > Next > Create. Press button on interface and automatically go to [...

.Net Core SignalR cannot add or use in startup

Ive recently come back to an old .Net Core application which was using SignalR. I think at the time the only SignalR NuGet package available for .Net Core applications was a preview. And it worked. ...

21 Aug at 12:13

IIS 10 ServiceStack .Net4.8 404

I recently upgraded to .Net Framework 4.8 and ServiceStack 5.6.0 on one of my projects. When I run it in Visual Studio through IIS express it works fine, but in IIS I get the following. HTTP Error 40...

22 Aug at 02:13

VS 2015 to 2017 migrate to package reference failed

I've inherited a VS-2015 C# application and would like to migrate it to VS 2017 or 2019. It has a packages.config file with 4 packages: ``` <package id="AjaxControlToolkit" version="15.1.4.0" targetF...

4 Feb at 12:35

UWP - No certificate found with the supplied thumbprint

I have a UWP app I work on from two difference devices. After the latest Visual Studio 2019 update I began receiving this error: > No certificate found with the supplied thumbprint: xxxxxxxxxxxxxxxx...

20 Aug at 16:51

ENC1003 C# Changes made in project will not be applied while the application is running

I am getting this incredibly annoying warning for every C# file in my ASP.NET Core project when I debug it after hitting F5: [](https://i.stack.imgur.com/hn52G.png) Because this error appears only d...

How can I get a list of registered middleware in ASP.NET Core?

In ASP.NET Core, you can register new middleware into the request processing pipeline during the `Configure` method of the startup class you're using for your web host builder by using `app.UseMiddlew...

20 Aug at 11:1

How to skip a test case which has Theory attribute not Fact

How to skip a data driven test case for some reason? I can skip a test case with Fact but getting an exception when using skip for parametrized test cases. Exception: Xunit.SkipException: 'Exception...

27 Jun at 16:7

What does the attribute "[ApiExplorerSettings(IgnoreApi = true)]" do?

I'm aware of what attributes in general do, the question is for this specific attribute alone. Sorry for the confusion! I've read the following [question](https://stackoverflow.com/questions/2795172...

20 Aug at 16:49

Build Errors in Visual Studio 2019 inconsistently show up in Error List

I recently updated from Visual Studio 2017 Community Edition to Visual Studio 2019 Community Edition. Now, if I build my solution with errors, they will show up in the build output, but not all of th...

19 Aug at 04:7

ServiceStack.Aws.DynamoDb: Is there async APIs?

[ServiceStack](https://servicestack.net) is a great library, and I'm now considering using it also for working with [AWS DynamoDb](https://aws.amazon.com/dynamodb/). However, the only async APIs I ca...