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...
- Modified
- 13 Jan at 04:34
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...
- Modified
- 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...
- Modified
- 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: `...
- Modified
- 9 Jan at 13:41
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 ...
- Modified
- 23 Feb at 07:0
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 ...
- Modified
- 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<...
- Modified
- 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) ...
- Modified
- 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 ...
- Modified
- 8 Jan at 19:7
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...
- Modified
- 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...
- Modified
- 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...
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...
- Modified
- 8 Jan at 10:16
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:...
- Modified
- 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_...
- Modified
- 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-...
- Modified
- 13 Nov at 16:6
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...
- Modified
- 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 ...
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...
- Modified
- 22 May at 04:17
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...
- Modified
- 5 Jan at 01:57
How to redirect to a different route in Blazor Server-side
In Blazor Client a redirection can be achieved using ``` using Microsoft.AspNetCore.Blazor.Browser.Services; (...) BrowserUriHelper.Instance.NavigateTo("/route") ``` This does however not work in a...
- Modified
- 22 Apr at 14:54
EFCore - How to exclude owned objects from automatic loading?
I'm trying to wrap my head around EF Cores owned objects and how i can control when to load certain chunks of data. Basically i'm having a bunch of old legacy tables (some with ~150 columns) and wan...
- Modified
- 4 Jan at 15:26
Simplify Attribute decorator on methods when referencing multiple libraries
This is a minor inconvenience, but it ends up generating a lot of boiler plate code. I'm using multiple libraries (ServiceStack.Net, Json.Net, the DataContractSerializer, etc), and to coerce all possi...
- Modified
- 4 Feb at 15:58
Why is `.Select(...).Last()` optimized, but `.Select(...).Last(...)` not?
Consider the following enumerator: ``` var items = (new int[] { 1, 2, 3, 4, 5 }).Select(x => { Console.WriteLine($"inspect {x}"); return x; }); ``` This yields the elements `[1, 2, 3, 4, 5]...
Any good way to debug Self Hosted https connection issues?
I am working with a self-hosted servicestack webservice on a Windows 10 machine and I am trying to enable https on it. What I have done so far is this: 1) I have created a wildcard cert using our co...
- Modified
- 4 Jan at 00:42