When does IDE0063 dispose?
I'm trying to understand this C# 8 simplification feature: > IDE0063 'using' statement can be simplified For example, I have: ``` void Method() { using (var client = new Client()) { ...
- Modified
- 12 Aug at 14:24
ServiceStack ServiceStack.Auth.OrmLiteAuthRepository
All of a sudden I got the following error message when I try to run my web application. "Method 'GetRolesAndPermissions' in type 'ServiceStack.Auth.OrmLiteAuthRepository`2' from assembly 'ServiceStack...
- Modified
- 12 Aug at 09:0
ASP.Net Core + Swagger - Actions require an explicit HttpMethod binding for Swagger 2.0
I have a project with following structure: ``` Controllers/ - Api/ - UsersController.cs - HomeController.cs Startup.cs ``` where looks like this: ``` namespace MyProject.Api.Controllers { ...
- Modified
- 11 Aug at 23:2
How use ImageSharp(Web) to compress / mutate stream with images(IFormFile)
I am trying to compress image(usually around 5-30) quality / size with [ImageSharp.Web()][1] library, and I cant really understand how can I do that or what I am missing here. - Can I reuse the same m...
- Modified
- 17 Jul at 08:37
Transactional annotation attribute in .NET Core
I am just curious, in Java, there is a `@Transactional` attribute which can be placed above the method name and because almost every application service method use's transaction, it may simplify the c...
- Modified
- 7 May at 03:51
"There was an error running the selected code generator: 'The value -1 outside the acceptable range of [0,2147483647]. Parameter name :value''"
I am working on an ASP.NET MVC project and so far I had no problems with scaffolding any type of items until now. Every time I want to create a new controller or view, I get the following error messa...
- Modified
- 28 Aug at 19:53
xUnit assert two values are equal with some tolerance
I'm trying to compare the precision of two numbers with some tolerance. This is how it was being checked in nUnit: ``` Assert.That(turnOver, Is.EqualTo(turnoverExpected).Within(0.00001).Percent); ``` ...
Hangfire - Multi tenant, ASP.NET Core - Resolving the correct tenant
I got a SaaS project that needs the use Hangfire. We already implemented the requirements to identify a tenant. - - - - `TenantCurrentService`- `DbContextFactory`- - - - I'm trying to stamp a T...
- Modified
- 7 Aug at 16:2
Project 'ClassLibrary1.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.8'
I have some class library projects in targets `netstandard2.1`. When I referenced that to my WPF project in target `.NET Framework v4.8`, On building time I get an error: > Severity Code Descri...
- Modified
- 7 Aug at 06:18
.Rdlc Report in MVC project - Managed Debugging Assistant 'PInvokeStackImbalance'
I am so close to getting my last report up and running. I have not had this problem with any other reports. I am trying to create a report based off a database record. When I go to create the report b...
- Modified
- 6 Aug at 21:44
ASP Net Core 2.2 add locker icon only to methods that require authorization - Swagger UI
## Versions: - - --- ## What I currently have? I have implemented swagger in my Web API project. And I am using JWT authorization with `[Authorize]` attribute on the methods that require...
- Modified
- 7 Aug at 08:9
How to sort List<T> in c#
I've got a `List<Card>`, and I want to sort these cards So, I'm looking for a method to sort them with different criterias, like their `ID`, their `Name` ... ``` public class Card : IComparer { ...
Defining OpenApi response schemas - particularly the example field - with ServiceStack.Api.OpenApi
When I generate an API spec on SwaggerHub, I can declare the schemas, including user-friendly examples, as follows: ``` components: schemas: Job: type: object required: - po...
- Modified
- 6 Aug at 00:48
How to know the jdk version on my machine?
I have recently uninstalled JDK 11 and installed JDK 8. For confirmation, I want to check which JDK is installed on my Windows 10 machine. I typed `java -version` on cmd then get the error message > j...
How to use environment variables in unit tests (.net core)
I have got a method that I am trying to test which uses environment variables from my "local.settings.json" ``` private static string _environmentVar = Environment.GetEnvironmentVariable("envirnomen...
- Modified
- 5 Aug at 13:29
How can I hint the C# 8.0 nullable reference system that a property is initalized using reflection
I ran into an interesting problem when I tried to use Entity Framework Core with the new nullable reference types in C# 8.0. The Entity Framework (various flavors) allows me to declare DBSet properti...
- Modified
- 4 Aug at 00:25
Could not load file or assembly Microsoft.VisualStudio.Coverage.Analysis in Visual Studio 2019 16.2
I recently installed VS2019 Prof 16.2 and experience following error when loading `.coverage` files: ``` Microsoft Visual Studio Exception was thrown: Could not load file or assembly 'Microsoft.Visua...
- Modified
- 3 Aug at 20:55
How to install Font Awesome in ASP.NET Core 2.2 using Visual Studio 2019
I am struggling to find any up to date installation guide for installing Font Awesome in ASP.NET Core 2.2 I've tried a manual file import to the project folder directory, then tried the NuGet package...
- Modified
- 15 Feb at 23:44
Removing object from array using hooks (useState)
I have an array of objects. I need to add a function to remove an object from my array without using the "this" keyword. I tried using `updateList(list.slice(list.indexOf(e.target.name, 1)))`. This re...
- Modified
- 21 Dec at 22:51
ServiceStack OrmLite OrderBy on joined table columns
I wish to make an OrderBy statement in OrmLite, using data from multiple joined tables in my query: ``` myQuery.OrderBy<MainTable, SubTable>((m, s) => m.Col1 < s.Col2) ``` just as you can with OrmL...
- Modified
- 3 Aug at 10:0
How do I specify "any non-nullable type" as a generic type parameter constraint?
The post is specific to C# 8. Let's assume I want to have this method: ``` public static TValue Get<TKey, TValue>( this Dictionary<TKey, TValue> src, TKey key, TValue @default ) => src.TryGe...
- Modified
- 24 Apr at 20:8
Net Core: Execute All Dependency Injection in Xunit Test for AppService, Repository, etc
I am trying to implement Dependency Injection in Xunit test for AppService. Ideal goal is to run the original application program Startup/configuration, and use any dependency injection that was in S...
- Modified
- 7 Aug at 04:49
C# Enums and Generics
Why does the compiler reject this code with the following error? (I am using `VS 2017` with `C# 7.3` enabled.) > CS0019 Operator '==' cannot be applied to operands of type 'T' and 'T' ``` public cl...
IAsyncQueryProvider mock issue when migrated to .net core 3 adding TResult IAsyncQueryProvider
I did something similar to : [How to mock an async repository with Entity Framework Core](https://stackoverflow.com/questions/40476233/how-to-mock-an-async-repository-with-entity-framework-core) in on...
- Modified
- 1 Aug at 18:58
How can I await an array of tasks and stop waiting on first exception?
I have an array of tasks and I am awaiting them with [Task.WhenAll](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task.whenall). My tasks are failing frequently, in which case I ...
- Modified
- 12 Jul at 06:46