C#

C

C#

We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.

Join

MySqlException: Table 'searchhome.aspnetusers' doesn't exist

So I wanted to do the following: I have already created a simple database with a table. On that db table some values have been added. I wanted to display that added value on my simple ASP.NET Core app. However, the dotnet run gave me the error as per screenshot attached (aspnetusers does not exist) The dotnet ef database update leads to the same error (aspnetusers does not exist). I have tried adding that aspnetuser table or tried updating the database( INSERT INTO __EFMigrationsHistory (MigrationId, ProductVersion) VALUES ('00000000000000_CreateIdentitySchema', '7.0.2');) None of these helped me out....

Winforms: add an existing form

Hello, im doing a proyect of login, and i want to add a new formulary, but in a new formulary (form2 ) i would like to import an already existing design, i know theres a way doing right click on the part where says "inicio de seion" with the green C# but if i do that that remplaces the form1 i already have and i dont want that Hope someone can help me...
No description

✅ Improving my etiquette writing C#

Hello I'm trying to improve my etiquette in writing C# , my question is about validation logic, how popular is it to write a class using C# auto implemented properties and than after to make a class who validates the previous class, is this a common practice ? What are other common practices concerning this topic ? Thanks in advance...

How to make upload file in ASP.NET Core?

any tutorial on how to make upload file in ASP.NET Core...via html, javascript, c# (backend code)..

Can i simplify the code???

can anyone help me to simplify the code? how can i make an algorithm that knows where u placed the X??????? please help, or else I'll be coding until next saturnday. If it's impossible (i dont think so) tell me and I'll go back to work. there are a lot of combinations.
No description

how to call another method

ok, so, I'll post a screen to explain better: how can i call a method that is on another file? or maybe i'm wrong and the question is hot to call a file. if anyone knows the solution please tell me. i want to make things better by making other files....
No description

Looking for c# library to create graph, blueprint like functionality in unreal engine

i want to create unreal engine blueprint like functionality so i'm looking for library where i can create such graphs. I don't need visual part, i will code visual part Something like https://github.com/RobinKa/netprints but i want to program those graphs/nodes...

✅ False Positive Virus Detection on my C# network ping code

So i'm trying to make a simple ping utility that just given a bunch of hostnames, does a ping to the host periodically, and graphs the results. I can make the app and it works fine for my needs. But I publish it and send it to my buddy to have a look at and his corporate Windows Defender says its a virus and deletes it. If i scan my published files it detects it as "MaxSecure Trojan.Malware.300983.susgen" on virustotal. the specific lines of code that seem to trigger this behaviour are as follows...

Why do we enclose the `Main` function inside of a class in C#?

After learning C++, I think it makes sense to include the main function outside of a class. Why do we not do it in C#? Like what disadvantage I would have by not including the main function in a class in C++? Would it be accessible to everyone? Does including the Main method in a class in C# make it "safer" than it being present at a global scope? What is the reason behind this?...

✅ Problem with a Recursion Function

I am currently programming a Snake-Clone and want to count the Parts(length of the tail) of the snake. Each part has a reference to the next part, called "next tail part". Is the recursion-function the problem, or something else? I am Printing the Result, by calling the function in the Debug.Log function : Console.WriteLine(DebugSnakeParts()); Function: private int DebugSnakeParts()...

✅ ASP.NET 'web' application

My exercise says the following: The path of the folder where we store the addresses should be customized: extend your program to read it from the appsettings.. I think I should just make the path (which is a json file) an environment variable in the appsettings. Does that make sense to do or should I just ask the teacher? If there are any other options that might work with the use of appsettings then please tell me....

✅ help with assignement

i am working on a project for school where we are supposed to create a calculator and also make a UML diagram. i am doing the Calculator.View part and i just want to check if i am on the right track. i added the assignment and the part i have started on in Visual studio but i am not done yet.

HttpClient does automatic retry after recieving 408 (Timeout) error code from server

Problem: When sending http request through httpclient to server, server intentionally returns 408 timeout error response and I want that response also. But what happens is, it is doing automatic retry after recieving this error code and send same request again after removing auth bearer token resulting in 401 (Unauthorized error). Note: I am not recieving 408 error response, recieving only 401 error response ...

How can I fix this system.runtime error?

The project is dot net 4,8 but I have no idea how to fix this. Im not sure whats its asking for either since I dont have the system.runtime referenced yet
No description

✅ ImmutableArray<T>.Contains(T, IEqualityComparer<T>) exists in one thread, but not another

this is a very confusing problem and i have not had any luck producing a minimal working example; i'm happy to provide any kind of info. i'm making a mod for a game (Celeste) that involves compiling and loading C# source at runtime; i'm using Microsoft.CodeAnalysis.CSharp for this. i already have a standalone prototype of that process and am trying to convert it into a mod. ...

can't find an image that is asked to be searched

so I've got this code that select a random image ``` private static Random rand = new Random(); private void SetRandomBackgroundImage()...
No description

Is this a TableLayoutPanel?

Hi there! Just wondering, is this created by a TableLayoutPanel, within itself? Quite a few controls inside an I quite like the design to be honest...
No description

How to make this Field into Property

```cs public class MyColumn { public List<string> Data { get; set; } public int Count => Data.Count;...

✅ .NET 8, EF Core, Fluent API - Schema definition is ignored when accessing via DbSet

HI, I would appreciate some hints where I have made the mistake. I am running an ASP.NET API. I am relying on EF Core for data accessing ORM. The db is scaffolded with Code first approach. I have created and mapped a new Entity. ``` protected override void Up(MigrationBuilder migrationBuilder)...