C#

C

C#

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

Join

NewtonSoft Serialization Exception

Hi i have a shared library i use on both client and server, most of JSON works fine, but in this example i have List.
Newtonsoft.Json.JsonSerializationException: Type specified in JSON 'System.Collections.Generic.List1[[RetrobineShared.DTOs.ItemDto, RetrobineShared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' is not compatible with 'System.Collections.Generic.List1[[RetrobineShared.DTOs.ItemDto, RetrobineShared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. Path 'UserBoard.Items.$type', line 1, position 267.
Newtonsoft.Json.JsonSerializationException: Type specified in JSON 'System.Collections.Generic.List1[[RetrobineShared.DTOs.ItemDto, RetrobineShared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' is not compatible with 'System.Collections.Generic.List1[[RetrobineShared.DTOs.ItemDto, RetrobineShared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. Path 'UserBoard.Items.$type', line 1, position 267.
...

I need to figure this out asap, with a problem in my program, please sendd me a friend request

I have a project I need to turn in asap, I cannot figure out what is wrong with one part, please help, send a friend request, its in visual studio community

Blazor - Identity Scaffolding Fails

Hi all, trying to scaffold identity into a blazor app. I have an AuthDbContext that looks like this
public sealed class AuthDbContext(DbContextOptions<AuthDbContext> options)
: IdentityDbContext<IdentityUser>(options);
public sealed class AuthDbContext(DbContextOptions<AuthDbContext> options)
: IdentityDbContext<IdentityUser>(options);
...

Updating datagrid gui from other threads

In wpf, I have an application that has a button and datagrid. The button over the datagrid adds an object to the datagrid called barProgress. The class barProgress contains one public int value called progress and is a default of 0 when initialized. The datagrid itself has two columns. Column one contains a progress bar for each object and Column two has a button that tells the progress of object to go up by one every second. I understand creating/adding/binding objects to the datagrid and their values. I added background workers (running async of course) per object to update the object.progress by one per second. Here's the problem. ...
No description

Help me

I want to learn about signalR in Asp.net core. could someone recommend some free books to learn it?

Hello i have a question

How to make BackGround in unity ground to step on for character
No description

Approaches to get around a big codebase

Hi guys I am second month in a new job, so far I've working for couple of years with a lot of Python, C/C++ projects with VSCode on Linux, thats the environment I am used to. Now I am working on Windows using Visual Studio on two solutions the C++ and C# one, that have hundreds of projects and they are dozens of millions lines of code. I am trying to get some work done on the C# solution, however, its a product that has a long history, there is a lot of weird design decisions, lack of documentation, extreme complexity, inconsistent style, tons of code, tons of components - lot of different processes each with a lot of different threads, communicating with different services across several machines of different architectures. Now getting around this is a headache, especially because I don't even know Visual Studio or other tooling very well. Do you have some tips for tools, articles, whatever how to get some high level sense of what is going on in such context fast? I am talking about the C# solution. Attaching to more than 1 process in VS and debugging it (without opening 1 instance of visual studio for each process)? ...

βœ… Having to press <return> twice?

```cs namespace Calculator.View { public class InputHandler {...

βœ… Addition with integers and floating point numbers

```cs namespace Calculator.Model { // The class for Addition "+". public class Addition...

Using sharppcap to read packets

I'm trying to read TCP packets using sharppcap in my .NET application but I can't seem to figure out how to check if it's a TCP packet or not, and read the data if so. Researching this, I could only ever find posts surpassing 7 years of activity and it has obviously been updated quite the bit since then. Does anyone have an idea on how to go about this?...

βœ… Abstract classes / Interfaces, why do we use them?

```cs // Interface interface IAnimal { void animalSound(); // interface method (does not have a body)...

C# RFID

I purchased an RFID reader along with its cards and want to use it in a Windows Forms application. However, when I connect it to my PC and try to read a card, the reading process doesn't occur. What steps should I take to resolve this issue?
No description

βœ… null reference

How do I fix possible null reference return do I add = null! after the errormessage or why does that come up as a warning? ```cs ...

C# Normal Map file a .tiff or .dds

I am trying to create a normal map to save to a file and I am getting a ton of crap results from google, codeium, phind, co-pilot, etc. I tried OpenCv2Sharp, SharpDX.Direct3D11 etc I am not a math person nor raw graphics so I will need some hand holding. Can someone help? Thank you....

Better way to check a list of characters?

There has to be a better way than doing this
myWord == "-" || myWord == "~" || myWord == "β€”"...
myWord == "-" || myWord == "~" || myWord == "β€”"...
I also don't really want to make a array and have to loop through them all because that seems like code would pile up quickly. I'm hoping for a function that does what I'm looking for?...

Use Custom Attributes with ASP.NET Identity

So recently i got into ASP.NET Identity with all the auth stuff so i can write more robust backend software But now i have a question, the way id like to handle permissions for users is by enabling scopes on them for example account.manage or profile.view for example, now in my backend id like to have have a middleware/attribute like [RequireScope("account.manage")] which uses the Authenticated user to see its scopes so now i have 2 questions 1. is it even a good idea to do it like that, if no what are my alternatives? 2. how can i implement this properly...

Connecting multiple computers with C#? How?

It's my first time creating an Inventory Management System that involves multiple computers (3 computers to be exact) Are there any things that I should look out for? And how do you even implement these type of systems? I don't have any experience in creating a system that involves 2 users. I have tried asking my Professors but they have just told me vague stuffs that really sound correct but I don't have any idea how I should do it. If someone can help me, thank you! Requirements (that I perceive): - There is going to be a master database that the system is latched onto - When Computer A inputs something, Computer B and C gets it too....

help me find correct response model

Hi, here is my database schema for a shop. I want to build a page to display product details. Use can choose between attributes and based on their choice I want to display price and quantity in stock (select variant of product). Some attributes might be unavailable. What's response model (dto) should I create and return as a response for this page to make less calculations on the client (for example group attribute value)?
No description

Async delegate causes WPF to freeze until search is done

I used delegates to implement async search in my program. I have a progress bar and a label that says "Starting Search..." that should be shown while searching. Currently, the wpf window freezes while searching, and the progress bar and label are not displayed. After the search is done, it'll update the label to show "Match is found" or "Match is not found". I implemented the same functionality using await, but I just can't figure out why I can't get it to work with delegates. I've been trying to debug this for about a week with no progress, so any help would be greatly appreciated Code: https://pastebin.com/tdxTWT8C...
No description