Category "c++sharp"

Net Core MemoryCache not resetting per request

.Net Core 3.0. I have a repo where IMemoryCache gets injected. Repo is registered as Transient. I would like for the cache to be cleared/reset PER request, howe

How can I use a modern Windows 10 context menu with a Win32 NotifyIcon?

My goal is to use the modern Windows 10 themed context menu with my C# application's tray icon. Eartrumpet's tray icon context menu uses it so I know it is poss

How to scan particular URL or page alone in owasp zap

I have installed OWASP ZAP 2.8.0 and scan our site fully. In result we got some SQL injection URL's or pages. So We have fixed that SQL injection issues in deve

ASP.NET Core (.Net 6) Web Application throws System.NotSupportedException when run as a service. (Service will not start)

When I attempt to run my .Net Web Application as a Windows Service, it does not start. It works if I just run the executable but mysteriously fails when attempt

Validate 5 digits in the textbox

I am trying to make the textbox valid when just the user writes 5 digits but the problem is if I for example input (11111) it will be correct, the program will

Add comments to records - C# 9

I'm looking for a way to add comments on record properties, in C# 9 When I try this code : public record Person { /// <summary> /// Gets the first

load failed UWP.csproj : error : Object reference not set to an instance of an object

My Xamarin.UWP suddenly won't load after Visual Studio 2017 15.4. I did update my Xamarin PCL and others. But the UWP Project will not load anymore. I can't g

net 5.0 Cannot determine the frame size or a corrupted frame was received

I want to try net5.0 since it's in rc2, and I've encountered a strange issue. I've created a default WebApi in net5.0. I didn't touch anything, I just clicked r

C# run python script from virtual environment

I am trying to run python script in c# with process. private void RunScript() { ProcessStartInfo processStartInfo = new ProcessStartInfo("python.exe", "c:\\

How to deal with IAsyncDisposable and IDisposable interfaces when no synchronous dispose available? [closed]

I am writing a Connection like class around an interop object. In particular, the closing of my connection is asynchronous. The object I am in

Clearing cache in Azure Function app and c#?

I'm using Azure Functions App and c# for coding. I want to clear the cache every 10 minutes for example, if there is a way to do that in the code ?

How to create an adapter for the Visual Studio Test Explorer? [duplicate]

I'm a bit stuck with the problem of creating a custom adapter for the Visual Studio test explorer. (Btw I'm using VS 2019). I need to create m

Delaying a task for a very very long time

If we delay a Task using the Task.Delay method for a very long time, let's say 6 months, and if we assume that the OS does not shutdown or restart during this p

Entity Framework Core too slow on First call

I have around 40 entities and everytime after I compile and run my app it takes almost 10 seconds whenever DbContext is called for the first time. Is there a wa

How to disable tracking changes within editor of Rider?

When Rider detects you are using some version control it will show for example gray triangles next to line numbers in places when some code was removed (within

Deploying a C# source generator project that includes references to other private projects

I want to release a source generator package, and I want to include a private project dependency on the source generator project. For example, assume that my pr

Unity C# error: (12,47): error CS1503: Argument 2: cannot convert from 'System.Collections.Generic.List<UnityEngine.GameObject>' to 'float'

I'm new to programming in general. With another Script i store in the list "spawnPointC" all gameobjects called spawnPointC that appear from spawning other pref

WebBrowser Control with Google 2-Step Verification

We have a class library that uses the .NET WebBrowser control to authorize access to a third-party API, either with that third-party's oAuth2 Authorization flow

403 Forbidden Error in Keycloak API (view-users)

I'm having issues trying to access auth/admin/realms/{realm-name}/users API. I've already tried everything from other questions and answers, but nothing seems t

Using ML.net with an ONNX model and GPU

How do you get Microsof.tML to run on an NVDIA GPU using C#? I followed the instructions https://github.com/dotnet/machinelearning/blob/master/docs/api-referen