Category "c++sharp"

How to seed data in .NET Core 6 with Entity Framework?

I know how to seed data to a database with old .NET 5.0 in startup.cs file using my Seeder class with a Seed() method creating some initial data. public void Co

C# Webapplication: Why is session usercount (in global.Session_Start) different from hub usercount (in hub OnConnected)

I want to display the number of currently active users. I first realized that in global.Session_Start protected void Session_Start(object sender, EventArgs e) {

System.Timer in .net core not tracking time correctly

I have this piece of code: public void StartTimer(string roomName) { var roomTimer = GetRoomTimer(roomName); var room = GetRoom(roomName);

Project currently contains references to more than one version

I am getting the following error. I tried to add references but I was unable to find a System.Web.Http in it. Please advice how to resolve this issue? The proj

Microsoft Visual Studio stuck in debugging mode

Whenever I run my code I am given an error messaging (error msg below) saying It is stuck in debug mode, and the console does not give me a string message for t

EmguCV C# ApplyColorMap Conversions

how do I correctly convert BitmapSource to Mat (to use it as input for the "ApplyColorMap" function)? I currently use this code: private static Mat ToMat(Bitma

Unable to start program, Access is denied C# net6.0

I have this issue where some of the projects I created for.Net6 throws the error shown in the image attached In this instance the project was running fine, sud

Unable to create a subscription for the DriveItem resource

I am trying to create a new subscription for the DriveItem resource on Microsoft Graph, I have a web application that handles the Files API successfully, I have

c# get html response after script application

I want to have the result of html page but after application of the javascript. If you prefere what i need is to have the html output and not the page code. See

Replacing System.Windows.Forms.WebBrowser with Microsoft.Web.WebView2.WinForms.WebView2 in WinForms apps

I am upgrading a WinForms C# .NET 4.8 Framework application and replacing the embedded browser System.Windows.Forms.WebBrowser with Microsoft.Web.WebView2.WinFo

Using RegEx to extract data from an anchor tag

I have the following anchor tag in an html document that I want to extract the link and the text from: <a href="https://www.catholicgallery.org/bible-drb/act

How do you fix this error: A namespace cannot directly contain members such as fields or methods [closed]

I am using unity code to make a game, and I get this error: "A namespace cannot directly contain members such as fields or methods." This is

How to filter excel file using three or more criteria and copy the filtered data to another sheet using powershell

I have a excel table as below: excel data I want to filter this file based on three criteria i.e. $criteria = "Rice","Vegetables","Butter" and copy the filtered

CS0120: An object reference is required for the nonstatic field, method, or property 'foo'

Consider: namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent();

How to find where an object is located in a list?

i have a list "players" and i want to find if my player is players[0] or players[1] or whaterver. How do i do this?

.NET 6 System.IO.FileNotFoundException: Could not load file or assembly System.Linq, Version=6.0.0.0

I am trying to migrate a project from .NET Core 3.1 to .NET 6. I have followed the official migration guide from Microsoft. During build in startup.Configure I

Unit Testing - How to build tests around domain entities with lots of encapsulation and many internal states

Admittedly, very new to Unit Testing right now but I'm wanting to make sure I don't end up with a testing project that ends up being a nightmare to maintain. Th

Telnet connection not writing tab to a file

I have a C# WPF application that is making a Telnet connection to write some content to a file on a Linux system from a Windows system. So say I have some text

.NET 5 to .NET 6 migration - How to fix appsettings.json data being read as NULL after migration? Dependency injection not working

In .NET 5 we have some settings that are read from the appsettings.json file. Now that we have migrated the code from .NET 5 to .NET 6 the model we created to h

OmniSharp fails to load properly in Visual Studio Code

I've recently started to write in C# on VSC using the 'C#' extension by Microsoft and I've been noticing that intellisense doesn't work at all. Every time I ope