C# How to split a List in two using LINQ

I am trying to split a List into two Lists using LINQ without iterating the 'master' list twice. One List should contain the elements for which the LINQ condition is , and the other should contain all...

10 Jan at 13:28

Why is it not possible to use the is operator to discern between bool and Nullable<bool>?

I came across this and am curious as to why is it not possible to use the `is` operator to discern between `bool` and `Nullable<bool>`? Example; ``` void Main() { bool theBool = false; Nullab...

10 Jan at 14:41

Using Factory Pattern with ASP.NET Core Dependency Injection

I need the ASP.Net Core dependency injection to pass some parameters to the constructor of my GlobalRepository class which implements the ICardPaymentRepository interface. The parameters are for co...

How to fix 'Unchecked runtime.lastError: The message port closed before a response was received' chrome issue?

I'm using VueJS and Laravel for my project. This issue started to show lately and it shows even in the old git branches. This error only shows in the Chrome browser.

Is useState synchronous?

In the past, we've been explicitly warned that calling `setState({myProperty})` is asynchronous, and the value of `this.state.myProperty` is not valid until the callback, or until the next `render()` ...

9 Jan at 23:1

ConcurrentDictionary GetOrAdd async

I want to use something like `GetOrAdd` with a `ConcurrentDictionary` as a cache to a webservice. Is there an async version of this dictionary? `GetOrAdd` will be making a web request using `HttpClie...

Column does not allow DBNull.Value - No KeepNulls - Proper Column Mappings

I am using c# with .NET 4.5.2, pushing to SQL Server 2017 14.0.1000.169 In my database, I have a table with a DateAdded field, of type `DateTimeOffset`. I am attempting to BulkCopy with the followin...

14 Jan at 03:45

ASP.NET Core - Error trying to use HealthChecks

I'm trying to use the .NET Core 2.2 Health Checks. In `ConfigureServices` I registered my class that implements the `Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck` interface. But when I...

9 Jan at 13:56

Cannot resolve scoped service DbContextOptions

I been searching around now for a clear cut answer on this issue, including github and still cannot see what I am missing here: Cannot resolve scoped service '' from root provider. In Startup.cs: `...

How to enumerate x^2 + y^2 = z^2 - 1 (with additional constraints)

Lets `N` be a number `(10<=N<=10^5)`. I have to break it into 3 numbers `(x,y,z)` such that it validates the following conditions. ``` 1. x<=y<=z 2. x^2+y^2=z^2-1; 3. x+y+z<=N ``` I have to find ...

Aspnetcore 2.2 Targeting .Net Framework, InProcess fails on azure app service with error TTP Error 500.0 - ANCM In-Process Handler Load Failure

I did upgrade of my app to aspnetcore 2.2 but due to some legacy limitations which I am planing to remove later I must target .NET Framework. New hosting model InProcess bring improvements so I want ...

12 Oct at 00:29

Why doesn't C# allow generic types to be used as attributes inside the generic class?

This isn't a very important question, I'm only curious why it's not allowed. The error message is not helpful in explaining, because obviously 'Att' inherit from Attribute. ``` public class Generic<...

13 Jan at 20:45

Children processes created in ASP.NET Core Process gets killed on exit

I'm spawning a child process in ASP.NET Core (.NET Framework) with `Process` class: ``` var process = new Process { StartInfo = new ProcessStartInfo(executableDir) ...

21 Jan at 11:12

Ef core: Sequence contains no element when doing MaxAsync

I'm using ef core in my asp core API project. I have to find the highest order index. Example: Data table: `Id, ForeignId, OrderIndex` So I'm doing: ``` var highestOrderIndex = await _context ...

servicestack and Serilog not working properly

I have not been able to successfully implemented logging in service stack. I posted here and on serilog GIT. The Serilog team believes it is a service stack issue. If you want access to my project let...

8 Jan at 17:42

Using Dapper to get nvarchar(max) returns a string trimmed to 4000 characters. Can this behaviour be changed?

I have a SQL Server data table which stores a JSON string in one of its columns. The JSON string is a serialised .net object and the data typically exceeds 4000 characters. I have a simple stored pr...

8 Jan at 17:54

Why doesn't the new hat-operator index from the C# 8 array-slicing feature start at 0?

C# 8.0 introduces a convenient way to slice arrays - see [official C# 8.0 blogpost](https://blogs.msdn.microsoft.com/dotnet/2018/11/12/building-c-8-0/). The syntax to access the last element of an arr...

29 Mar at 21:13

Visual Studio does not display .NET Core 2.2 in Target Framework dropdown

I just cloned into an already existing project for work, and have found that for some reason, Visual Studio refuses to show .NET Core 2.2 in the "Target Framework" dropdown menu in the Properties -> A...

Asp.net core 2.1 UseHttpsRedirection not working in IIS

I deployed my asp.net core 2.1 WebApi to IIS 10. (The IIS worked as a proxy) I have added a SSL cert in IIS and bindings for both insecure port (8081) and secure port (8082). But when I visit [http:...

8 Jan at 09:16

StripeException: No Such Plan

I'm creating a customer object and assigning them to a plan in Stripe and am getting the error "no such plan exists." The plan id that's given in the error is the correct plan id: `No such plan: prod_...

7 Jan at 17:33

How to create thumbnail image in .net core? Using the help of IFormFile

I need to create a thumbnail image from the original image and need to save both images in the local folder. I am using html file control for uploading the image ``` <input type="file" class="form-...

Google Calendar API with ASP.NET

I'm confused about using the Google Calendar API for adding/modifying events in ASP.NET webforms (C#). I'm not sure if I need oAuth or what. My app is on my own server accessing my own domain and my...

6 Jan at 22:36

How to pass parameters to the dotnet test command while using NUnit or XUnit

I'm developing some end-to-end tests using C# with .NET Core, Selenium and NUnit. Now i want to write a login testcase. My tests are started from console simply by using the `dotnet test` command. I ...

8 Jul at 09:20

Configuring abstract base class without creating table in EF Core

I have added `DateCreated`, `UserCreated`, `DateModified` and `UserModified` fields to each entity by creating a `BaseEntity.cs` class. My requirement is to generate single table which is having all t...

Is there a good example of handling ServiceStack validation errors in an ASP.NET Core MVC controller?

The question is self explanatory. Basically I want the api ton act as the service/business layer. All logic should be handled here with validation errors and othe messages being returned back and ha...

5 Jan at 01:57