Category ".net-core"

How do I use Visual Studio 2019 to remotely debug a .NetCore application on a Hyper-V Linux VM?

I am attempting to remotely debug a .NetCore application in Ubuntu Linux from Visual Studio 2019 in Windows 10. I can see the remote ipaddress (ping thru comman

How could I get a parameter of an action from the ResultExecutingContext when using a Filter

I'm creating a custom result filter that implements IAsyncResultFilter interface. In this filter I need the actual value returned by the Action, but I also need

JetBrains Rider - configure appsettings overrides

I am trying JetBrains Rider for my existing .NET Core project. In the project I have several appsettings.json overrides: appsettings.Development.json - for dev

How to return HttpStatusCode 404 for incorrect url with FallbackPolicy set in AuthorizationOptions?

In the web application I'm currently working on there is a requirement for all users to be authenticated. This is currently handled by using an AuthorizeFilter.

Role based authorization using Keycloak and .NET core

Having a few minor issues with role based authorization with dotnet core 2.2.3 and Keycloak 4.5.0. In Keycloak, I've defined a role of 'tester' and a client rol

Storing DateTimeOffset value without milliseconds in SQL Server using EF Core

Say I create a DateTimeOffset value like this: var dt = DateTimeOffset.UtcNow; And I want to store this value in SQL Server using EF Core code-first. How do I

Calling Another Project's Controller From A Project In The Same Solution (.NET Core )

There are 2 projects in the same solution. First project is a .NET Core project and it has all the codes(controllers, models etc.) related to packages. I need t

What is the right macro for platform?

I'm trying to write a pre-build event script that must be able to adapt the the build platform (Windows / Mac / Azure DevOps image) in my case. So far I have fo

Disable verbose logging of symbol loading in vscode debug console

When running my webapp (in vscode), the debug console is filled with lines like these: Loaded '/foo/bar/dotnet/shared/Microsoft.NETCore.App/2.2.4/System.Pri

Oracle SQL statement returns no rows when executed from C# application

Following SQL statement returns data when executed in Oracle SQL Developer: SELECT TC_GUID FROM TBLBUF WHERE TC_DEST = 'aaaaaaa' AND TC_STATE <= 20 but when

IPC using .NET Core that supports duplex channel or callbacks

I am evaluating .NET Core 2.0 for IPC communication. I found that .NET Core does not support WCF on the server side. What can be used in .NET Core for inter-pro

Application Insights duplicated logs

I have a .net core API running under Azure Kubernetes service, with Application Insights provisioned with Terraform. When viewing Application Insights in the Az

error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.3\Microsoft\Portable\v5.0\Microsoft.Portable.CSharp.targets" was not found

I have .net core test project. When I build it in visual studio or use the TestManager it build without a problem. But when I execute the following command on t

Creating a tree from a collection List<T>

In order to create a tree, I use the following code. var db = _context.GetContext(); var accounts = await db .Set<TradingAccount>()

How to write Repository method for .ThenInclude in EF Core 2

I'm trying to write a repository method for Entity Framework Core 2.0 that can handle returning child collections of properties using .ThenInclude, but I'm havi

.Net Core unable to use Bitmap

I am working on a Web Service using .Net Core 2.1. I have a byte array containing all pixels values (in grey scale), a width, a height. I want to create a bitm

ASP.Net Core Web API ModelState unvalidated when Dictionary used in FromQuery

I have a GET endpoint which accepts a few parameters and a Dictionary in the Query. public IActionResult Get([FromQuery] RequiredFields required, [FromQuery] D

How can I build an IOptionsMonitor<T> for testing?

For the normal IOptions interface, you can manually build an instance e.g. this SO question. Is there any equivalent way to make an IOptionsMonitor instance wi

Reload Serilog JSON Configuration on changes in .NET Core 2.1

I'm currently working on a ASP.NET Core 2.1 application and I use Serilog for logging. I want to reload the application settings file for my Serilog implementat

Kestrel error: address already in use (dotnet core)

Summary: it works as dotnet run, but it doesn't work as dotnet myappname.dll. My linux skills are limited, but I am trying to go by the book so I don't mix thi