Questions tagged [.net-core]

.NET Core is an open-source, modular implementation of the .NET Framework. It can be used in a wide variety of applications and verticals, ranging from servers and data centers to apps and devices. .NET Core is supported by Microsoft on Windows, Linux and macOS.

Filter by
Sorted by
Tagged with
0
votes
1answer
42 views

What is Property Accessor Recursion in C#?

What is Property Accessor Recursion in C#? I see articles of how to resolve it, but want a pure technical definition of what it is. Resources on how to resolve it: c# property setter body without ...
0
votes
2answers
26 views

Net Core: Resolve “Add a way to break out of this property accessor's recursion”

I am trying to create a simple class. ColumnSort member is a list of items in comma delimited text "Car,Book,Food". ColumnSortList creates a List Car Book Food C# and SonarQube is mentioning ...
0
votes
0answers
10 views

How to Reference .Net Core Library in a >Net Core Console Application

I am following this code example I am on Visual Studio Community 2019 for Mac. I created a .Net Core - Class Library project and compiled to create the assembly file P1-ProgramStructure.dll. I ...
0
votes
0answers
13 views

Visual Studio 2019 Community cannot create WPF App (.NET Core)

When I try to create a WPF App (.NET Core) in Visual Studio 2019 the following error appears: When I go to the spot I have it checked off already; Yes, I have restarted both VS and my computer. I ...
0
votes
0answers
40 views

Net Core: Overloading Methods or Inheritance, looking for efficient method

I have simple calculator class. This question actually hides more complex scenario at work. https://www.c-sharpcorner.com/article/a-simple-calculator-class-in-C-Sharp-6/ public class Calculator { ...
5
votes
1answer
68 views

Do multiple instances of System.Random still use the same seed in .Net Core?

I've seen several articles talking about not generating too many System.Random instances too closely together because they'll be seeded with the same value from the system clock and thus return the ...
0
votes
1answer
9 views

How to use .NET Core 3.0 Preview8 with App Center Build

I've implemented .NET Core 3.0 Preview 8 into my app, but now when I try to use App Center, I get this error message: The current .NET SDK does not support targeting .NET Core 3.0 ================...
0
votes
0answers
40 views

Ajax - how to save data to backend? [on hold]

The end goal is to save one chosen movie from a list using omdb api to a backend model. How can I add a button for each rendered movie so they can be saved in a list using an MVC model? Is there a ...
0
votes
1answer
19 views

Entity Framework Core: Global select filter

In EF Core you can add global query filters to exclude data that fulfill some condition. I was wondering if the "same" exists for globally selecting properties of entities, e.g. to globally exclude ...
0
votes
0answers
15 views

Is ConfidentialClientApplication.AcquireTokenForClient().ExecuteAsync() thread safe?

In .net core using MSAL.NET v4 (nuget Microsoft.Identity.Client v4.3.0) is ConfidentialClientApplication.AcquireTokenForClient().ExecuteAsync() safe to use in a singleton registered service ...
1
vote
1answer
39 views

How to downgrade Blazor app from .Net Core 3 to .Net Core 2

I have finished Blazor application using .Net Core 3 on Visual studio 2019 Community (Not Preview), but when I tried to publishing it on the host I found that the host doesn't support .Net Core 3, ...
0
votes
1answer
10 views

Unable to execute dotnet run comman

When I am inside the project directory and try to run: donet run then I get following errors: Startup.cs(5,7): error CS0246: The type or namespace name 'Localdb' could not be found (are you missing ...
0
votes
1answer
25 views

Razor Pages - Create unique identifier for controls in foreach loop

How can I create a unique name referance for a set of checkboxs when using foreach loop? @foreach (var item in Model.myClass.Where(i => i.ID1 == 0)) { <input type="text" asp-for="@item.Stuff" ...
4
votes
1answer
39 views

Why does this IDisposable get disposed while referenced in a F# task?

A while ago, in one of our (X)unit tests, a colleague of mine wrote: [<Fact>] let ``Green Flow tests`` () = use factory = new WebAppFactory() use client = factory.CreateClient() ...
0
votes
0answers
31 views

Why does a dotnet Core App with a reference to a classic .Net project works and compiles

I was under the impression from other questions and experience that you could not reference a classic .Net project from a dotnet Core project. Referencing old (full .NET Framework) Class Library when ...
3
votes
1answer
67 views

How should i register generic interfaces in .NET Core 2.2

I'm trying to create a new .NET Core API with generic repositories and services, where each Type has its own interface with the corresponding implementation. I created a generic repository and the ...
0
votes
0answers
37 views

How to implement multiple HttpClientFactory when calling multiple Web APIs

I have implemented a Web API call from the .net core Console Application. I am injecting a Named HttpClientFactory to create HttpClient object to call Web API. Below is the code: public class StartUp ...
0
votes
0answers
15 views

Dotfuscator: Couldn't find Microsoft.AspNetCore.Hosting.Abstractions Version=3.0.0.0

Dotfuscator was working fine until today. I cannot figure out why. My project type is aspnetcore 3.0. Publish using the following command: dotnet publish --self-contained -c Release -r linux-x64 ...
0
votes
0answers
13 views

How to write a web api in .net core 2.2 to consume Kronos API [on hold]

I'm trying to write a .NET core web api application which will have various APIs to consume Kronos APIs. Need the code in C# .NET CORE 2.2
0
votes
0answers
11 views

Sending X-XSRF-TOKEN in header result forbidden,status:403 using HttpClient in c#

The request through postman work fine. while in C# it give me the exception as the cookies and header values i get from browser call details in chrome. forbidden","status":403 The code so far, I ...
0
votes
1answer
16 views

Net Core: Does X.Paged List allow Multi Column Sorting?

Does X.PagedList allowing Multi Column Sorting, say Sorting by ProductName, and then Product Price? What is the directions and syntax for this? Trying to read the directions here, https://github.com/...
0
votes
1answer
30 views

Multiple Values Contains with Dynamic Linq

How to use Multiple value with Contain in Dynamic Linq. Expected With Normal Linq : using System; using System.Linq; public class Simple { public static void Main() { string[] names = { "...
0
votes
1answer
18 views

How to add custom properties to the IdentityServer4 PersistedGrantStore

We are using the default implementation of IPersistedGrantStore with EntityFramework and SQL Server. I have a requirement to store the IP address (to get 'ballpark' location data on 'sign ins') this ...
0
votes
1answer
29 views

Unable to call WebAPI from .Net Core 2.1 console app after install .Net Core3.0

I am getting Error 407 (authenticationrequired) when calling WebAPI from .NetCore2.1 console app. I tried on other PC which doesn't have .NetCore3.0 installed, it works smoothly. I tried ...
0
votes
1answer
47 views

Mocking class with multiple interfaces

I am trying to test a method that is using two different interfaces. Using Moq I configure the interfaces methods and set a return object, but just the first method executed returns value, the second ...
0
votes
0answers
13 views

What's the difference of X509Certificate2.PublicKey.Key between .net core and .net framework

When migrating one of my projects from .NET Framework 4.6 to .NET Core 3.0, I find one line of code doesn't work in the new framework: X509Certificate2 clientCert; var csp = (RSACryptoServiceProvider)...
0
votes
0answers
23 views

Getting Error to publish.Net Core Api on Azure server

I am getting an error while publishing .net core API on Azure Server. Severity Code Description Project File Line Suppression State Error Web deployment task failed. (Connected to ...
0
votes
1answer
58 views

Resolve IQueryable and Async in Method

I am trying to incorporate principle of Async and implement correctly. In code below, departmentRepository.GetAll returns IQueryable. After that, GetPage(1,3) returns IEnumerable. Just curious if new ...
0
votes
0answers
19 views

How To Mail Sending with with Exchange Server in .Net Core. Null Referance Exception [duplicate]

I got the error that I want to send mail with Excahnge Service in .Net Core but wants object reference to an instance of an object according to your submission. Can you help? I'm getting the error on ...
-2
votes
1answer
24 views

ASP .NET Core hosting on IIS - Null reference at AspNetCore.Views_Shared__Layout.ExecuteAsync() [duplicate]

I have been banging my head at the wall for the past two days and I just can't seem to figure out what is the problem in my .NET CORE MVC application. It is a simple web app with multiple pages and I ...
0
votes
1answer
30 views

.Net core DI Scope validation , scoped vs transient?

Reading the docs : When the app is running in the Development environment, the default service provider performs checks to verify that: Scoped services aren't directly or indirectly ...
0
votes
1answer
35 views

How to perform parallel Insert/Update/Delete operations on same table and context in hosted services?

So basically I have 4 environments SB, NP, PR and DR and I have a API endpoint for each environment. What I'm trying to do is call each API endpoints and get some data and save it into the database. ...
0
votes
0answers
16 views

HTML to PDF Conversion Library for use in .Net Core Azure app service [on hold]

I am part of a team working on a .Net Core MVC app service that runs in Azure. We need a library that will reliably convert HTML to PDF. We initially tried the free version of Select PDF, but ran into ...
0
votes
1answer
13 views

How to retrieve installed printers on macOS in C#

I'm writing a console application, and one of the things that application needs to do is retrieve a list of all of the user's installed printers (as well as their paper sources). We can obtain this ...
3
votes
1answer
52 views

Net Core: Find Data Type for any Variable Field in Class

How do I take this OrderBy Expression tree and make it accept any Order type , int, float, string, boolean etc? Is it possible? Right now its typecasted to only string. Should I just convert ...
-2
votes
1answer
36 views

Invalid framework identifier Dotnet restore, docket build

i'm having this error when i try to run docker build in my dotnet core API: Invalid framework identifier '' Here is my dockerfile: FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS ...
0
votes
0answers
12 views

Override Global Authentication For Endpoint In .Net Core 2.2

I am creating an api, which has a hundred endpoints that I want my custom authentication handler applied to, so I used the AuthorizeFilter in my Startup.cs. services.AddAuthentication(...
0
votes
1answer
19 views

HttpRequestException when using HttpClient on Dotnet Core on Raspbian

while creating a Telegram Bot which is supposed to run on my Raspberry Pi, I am facing the following error when running code, which is using an underlying HttpClient: System.Net.Http....
1
vote
0answers
20 views

XML validation in .net core 2.2 and .net framework 4.6

I am trying to convert our application from .net framework to .net core 2.2. We have a method that validates an XML against an XSD. It was working without any issue in .net framework but as I moved it ...
1
vote
1answer
12 views

How to concatenate conditional RequireClaims Expressions in AddPolicy statement

I'm configuring my Authorization method in this way: services.AddAuthorization(options => { options.AddPolicy("Branch", policy => policy.RequireClaim(ClaimTypes....
1
vote
1answer
22 views

Not able to attach auth token from cache in hosted services

I'm new to .net and I really want to understand this behavior of an application. I have a function called GetOrg() which basically requests the API endpoint and grabs the data, to get the data I need ...
0
votes
1answer
59 views

All controllers and constructors run twice

I have a .net core web project. This is identity project. I have developed Identityserver4. But I noticed something, all methods constructor methods works twice. Now, no layout, no javascript, not ...
1
vote
1answer
33 views

Retrieving data from csv are 0 or null

I' trying to import from a CSV some data into c#. The problem that i'm facing is that the data are 0 or null. although I map their headers with the CSV headers. This are some photos of what the csv ...
0
votes
0answers
11 views

Convert/Create wpf to .net.core

I have serious trouble converting a wpf solution to Net.Core What I have : Visual Studio 2019 Version 16.2.3 Net.Core SDK's .NET Core SDK (gemäß "global.json"): Version: 3.0.100-preview8-013656 ...
0
votes
0answers
30 views

Specification Pattern for Pagination with Generic Repository [on hold]

I want to implement a Paging Specification Pattern to a Generic Repository. I don't agree with generic repository, but architect needs it at company. Does anyone have any general library specification ...
0
votes
1answer
73 views

.NET Core application does not start

I create an application using Microsoft Visual Studio 2019 Preview (version 16.3.0 Preview 2.0). After I published it using CLI, application does not start on consumer's machine without an error. When ...
0
votes
0answers
8 views

Why does debugging my .Net core app duplicate my files in /bin but not in another project?

I have two .Net Core projects. When I debug either project, a /bin folder is created. But in one project, all my files basically get duplicated in there (and causes "Ambiguity errors to come up ...
1
vote
1answer
45 views

Deploying .Net Core 2.0 App Includes 150+ Dlls

I recently updated my Visual Studio version from 2017 to 2019 also installing the .net core version 2.2. I had .Net Core 2.0 web projects which only contained the dlls that were added through out the ...
0
votes
2answers
23 views

Not able to find “KeyVaultKeyReference”

I am trying to run this script in Powershell, but I am encountering the following error when I do so: PS C:\Users\knandan\work\DigitalSolutions\RnD> .\Copy-keys.ps1 At C:\Users\knandan\work\...
0
votes
0answers
26 views

Anti-forgery validation with Asp .net core and angular

I have implemented Anti forgery token with angular SPA and .net core in the following way, .net code services.AddAntiforgery(options => { options.SuppressXFrameOptionsHeader = true; ...