Questions

How to upgrade all solution projects .Net framework 4.5.1 to 4.8 Visual Studio 2019

I have a solution in Visual Studio 2019 with many C # projects. I need to retarget all of the projects from the .NET Framework 4.5.1 to 4.8. Is it possible to change target at once or do I have to do ...

How can I get access to the IWebHostEnvironment from within an ASP.NET Core 3 controller?

I would like to be able to browse a directory in the web root (such as my \img directory or \pdf directory) from code within a controller. I would like to use something like the following where `env`...

12 Dec at 13:16

No IUserTwoFactorTokenProvider named 'Default' is registered. Problem is AddDefaultTokenProviders() in two (2) ASP.NET Core Identity registrations

I have (2) `Identity systems`, each in its own `Context`: ``` 1: CustomerContext : IdentityDbContext<CustomerUser> 2: ApplicationContext : IdentityDbContext<ApplicationUser> ``` I have successfully...

Rendering view to string in core 3.0: Could not find an IRouter associated with the ActionContext

In my application, I want to use a template for my e-mails. Unfortunately code I used before in another project doesn't work anymore. ``` Could not find an IRouter associated with the ActionConte...

12 Dec at 10:25

What's the difference between returning AsyncEnumerable with EnumeratorCancellation or looping WithCancellation

I have the following method that reads a csv document from a http stream ``` public async IAsyncEnumerable<Line> GetLines([EnumeratorCancellation] CancellationToken cancellationToken) { HttpRespo...

15 Jun at 13:4

How to pass a URL input parameter value to Blazor page?

This passes a value into a blazor component ``` [Parameter] public string Id { get; set; } ``` But what about passing a value from the URL input parameter?

12 Dec at 07:0

Initialize Google Protobuf RepeatedField collections

When you try to initialize a repeated field member (property) of already generated Google Protobuf message type, you can't use a setter since they are read-only. How to initialize google Protobuf mess...

16 Aug at 11:23

Why do I get the 'loop of ufunc does not support argument 0 of type int' error for numpy.exp?

I have a dataframe and I'd like to perform exponential calculation on a subset of rows in a column. I've tried three versions of code and two of them worked. But I don't understand why one version giv...

12 Dec at 04:4

.Net Core: Return IActionResult from a custom Exception Middleware

I have created a new Exception middleware in my .Net Core application. All the exceptions throughout the application are captured and logged here. What I want is to return a IActionResult type like In...

How to inject in blazor code behind .razor.cs file? IJSRuntime for example

With a normal single page razor component in Blazor. I can inject `IJSRuntime` like this at the top of the page: ``` @inject IJSRuntime JSRuntime ``` If I create a code behind .razor.cs file for th...

Asp.Net Core 3.0 CreatedAtAction returns "no route matches the supplied values" when Action name ends with "Async"

I had a strange problem with CreatedAtAction, if my method name ends with "Async" keyword, I get an 500 error "no route matches the supplied values" when I return CreatedAtAction from my Add method. I...

Hiding Types from Autoquery Metadata

I have an RDBMS AutoQuery setup with Custom QueryDb object which is the only object I wish to be exposed by Autoquery metadata, however, it is exposing all my ORMLite data objects to the UI. Is there ...

How do I resolve the issue the request matched multiple endpoints in .Net Core Web Api

I notice that there are a bunch of similar questions out there about this topic. I'm getting this error when calling any of the methods below. > I can't however sort out what is best practice in...

error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

> error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1) I tried 'push' while writing 'git'. However, the following message does not solve the problem. [](https://...

11 Dec at 11:39

Dependency injection: HttpClient or HttpClientFactory?

Everywhere I can see three main approaches to create clients (basic, named, typed) in DI, but I have found nowhere if to inject `IHttpClientFactory` or `HttpClient` (both possible). : What is the di...

How perform a drag (based in X,Y mouse coordinates) on Android using AccessibilityService?

I want know how to perform a drag on android based in X, Y mouse coordinates? consider as two simple examples, the Team Viewer/QuickSupport drawing the "password pattern" on remote smartphone and the ...

GetPathsOfAllDirectoriesAbove() cannot be evaluated after updating .Net Framework version (4.6.2 to 4.7.2)

A project I have been working on was upgraded from .NET Framework 4.6.2 to 4.7.2. On build, in a file that is not my code, I get the following error: [](https://i.stack.imgur.com/oTuXz.png) I also s...

22 Apr at 09:46

EF models. Navigation properties can only participate in a single relationship

I have my entities like this, they are closely linked. ``` public class Game { public int Id { get; set; } public int FirstTeamId { get; set; } public Team FirstTeam { get; set; } p...

Typescript eslint - Missing file extension "ts" import/extensions

I have a simple Node/Express app made with Typescript. And eslint give me the error ``` Missing file extension "ts" for "./lib/env" import/extensions ``` Here is my .eslintrc file ``` { "extends": ...

9 Dec at 19:42

Why I am suddenly getting a "Typed property must not be accessed before initialization" error when introducing properties type hints?

I have updated my class definitions to make use of the newly introduced property type hints, like this: ``` class Foo { private int $id; private ?string $val; private DateTimeInterface $...

Your target project 'x' doesn't match your migrations assembly 'xx'. Either change your target project or change your migrations assembly

.net core 3.0. I have a LibraryProject(SyWaterStandardLibrary), There's a DbContext.When I build new WebProject(WebApplicationTestLibrary) and using LibraryProject. Startup: ``` services.AddDbConte...

Razor Pages vs server-side Blazor

[Razor Pages](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-3.1&tabs=visual-studio) is used for server side web applications, just like in the good old days. [Blazor](ht...

10 Dec at 10:24

Trouble running C# code in VS Code: Getting scriptcs error

This is my first time using Visual Studio Code and I am trying to run a simple code on it but it is giving me an error that says: > 'scriptcs' is not recognized as an internal or external command, ...

10 Dec at 08:7

The constraint reference 'string' could not be resolved to a type. (netcoreapp3.0)

I have got an error. This is my Startup class. ``` public void ConfigureServices(IServiceCollection services) { services.AddControllers(); } public void Configure(IApplicationBuilder app) { ...

'IServiceCollection' does not contain a definition for 'AddControllers'

I have a ASP.NET Core 3.0 project running fine with the following startup: ``` public void ConfigureServices(IServiceCollection services) { services.AddCors(); services.AddControl...

9 Dec at 20:46