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
Specify EF Core column/field as read only
I have a SQL Server table with certain fields that are set by the database via default values that, once saved, should **never** been modified again (e.g. `DateCreated`). In the Entity Framework Core ...
- Modified
- 5 May at 18:38
How do I create a cookie client side using blazor
I have a login page that goes off to the server gets a bunch of data, then I want to take some of that data and save it into a cookie using Blazor on the client. So To start I have successfully injec...
ANCM InProcess startup failed because of invalid runtimeconfig.json
The application is deployed as an (32-bit, .NET Core 2.2) App Service on Azure. It works fine when using the standard `AspNetCoreModule` instead of the newer `AspNetCoreModuleV2` that supports the `In...
- Modified
- 3 Jan at 12:3
Collapse Grid Row in WPF
I have created a custom WPF element extended from `RowDefinition` that should collapse rows in a grid when the `Collapsed` property of the element is set to `True`. It does it by using a converter an...
- Modified
- 6 Jan at 14:42
Custom bindings in Azure Function not getting resolved
I'm trying to create my own custom binding for Azure Functions. This work is based on 2 wiki articles concerning this feature: [https://github.com/Azure/azure-webjobs-sdk/wiki/Creating-custom-input-an...
- Modified
- 20 Jun at 09:12
Group alternate pairs using LINQ
I am trying to group a list of [DTOs](https://en.wikipedia.org/wiki/Data_transfer_object) which contain alternate family pairs to group them in the following format to minimize duplication. Here is t...