C#

C

C#

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

Join

Implementing Google OAuth throws an error after logging in

I'm losing my mind over this, I'm sure it's a minor fix but I can't seem to get it working, I've setup the Google OAuth controller, and everything seems to be working at glance, the application builds, the url gets me to google, i can select my account, but once it tries to call the callback, it says the oauth state is missing or invalid https://github.com/lumijiez/raven/blob/dev/auth/server/Raven/Raven.Auth/Controllers/GoogleOAuthController.cs https://github.com/lumijiez/raven/blob/dev/auth/server/Raven/Raven.Auth/Startup.cs...

Question about best practices for project org

Im a beginner in C#, but I do have extensive experience in JS (NodeJS/React). That means I can make things work by just googling answers, but there's one thing thats been confusing the hell out of me: Project structure & naming conventions ...

Slope Physics not working when trying to make Sonic face movement direction

I'm working on a 3D sonic framework in Unity, and I'm starting to implement animations and player rotation. I ran into a bit of a problem where animations are all working as intended which is good, and the rotation works well on flat ground, but it messes up the slope physics completely, and when braking sonic turns at a slight angle for some reason. It should be in the video but it's kinda hard to pick out because I haven't added the braking animations yet. (turning off the rotation script makes everything work normally again so it's definitely the rotation script that's the problem). I've been trying to figure out a solution for a bit now but with no luck, so some help in figuring this out would be greatly appreciated. Here are the relevant scripts for this: RotationHandler (attached to capsule): https://pastecode.io/s/rv1418xi...

JSON Deserialization Multiple Entries

Hello. Is there an easy way to enumerate through this .json and pull out the data I need onto a UI? Stuff like Prop ID, Prop Name, etc. Of courses there's multiple props per .json so I'd need to be able to deserialize them all, edit them, and reserialize back. ```json { "data": [...

Hell

I understand that height and weight are local, any way to make them global?
No description

Calls in .NET Maui

Hello! Can I add an option for calls between two C# Maui applications? I mean something like Messanges, WhatsApp etc. and is it too hard to do it because i don't have any experience with C# Maui 😄

EF Core Defined in Library Assembly, Configured in ASPNET Asembly

Hey, I've been away from netcore for a while and im getting back into it. I have two assemblies right now: * Journey.Web * Journey.Application I haven't decided to seperate much yet, just keeping the entrypoint seperate from the core logic. Thus most behavior is in the Journey.Application assembly. ...

Need help with a bug

Hi, im currently making one of my exercises and i am stuck on a bug. Im making a bossfight thing based on random numbers if it is a critical damage or not. The bug im stuck is the one on the picture. it seems that the damage goes to 200 but the max damage is 100 when critical and 50 when normal. does anyone see the mistake i made? my code: class Program {...
No description

✅ What is considered enough knowledge to start applying?

So it's not my first job, I got my first job which lastest 6 months right after I got my associates degree, it was C# and .NET focused think I was using .Net 4, and now my most recent job was more Js/Php/Python but I just got laid off 2 weeks ago with no heads up and now I feel like I'm not good enough at my job, so I've spent the last 2 weeks trying to learn C# and .NET to apply for jobs in my area. I found a roadmap and ive been doing it order but is all of this required before you can actually start applying?? I've finished the first 3 courses and im onto the fourth now, and in between I've been going through this course (https://www.udemy.com/course/ultimate-csharp-masterclass/learn/lecture/35867028#overview) to really learn C# I am at section 9 currently. I'm going to keep going through all this material but I was just curious at what point would you have enough knowledge for a base level or junior level position?...
No description

Help me understand the GC in depth

I'm interested in the inner workings of the CLR GC but the source code looks very complicated to me and uses a lot of jargon I'm not familiar with. I've read the "surface level" design doc (https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/botr/garbage-collection.md) but it doesn't contain the information I'm looking for. I'm particularly interested in the data structures it would use to keep track of objects during the compaction phase. Here are some questions I'm trying to find the answer to (along with answers that I tried to guess myself but could be completely wrong) : - how does it know the type of an object at a pointer ? is it present in some metadata header before each object in memory or does it know based on where it got the pointer from (aka, it knows the type of the object at the root so it knows the types of the fields, and then it would know the types of those fields, etc...) idk how that second approach would fit into the whole polymorphism thing though, so my guess is it's the first option. If it does use a header for each object, how big is it ? If I allocate a class containing one byte of data, is it going to add hundreds of bytes of metadata to it ? - how does it know how to iterate through all objects on the heap ? Again, one thing it could do would be to start at the roots and recursively explore the fields in those objects, but I have a feeling it's not the most efficient approach. My other idea would be that every object is prefixed with metadata (in some sort of header again) that would give its size so that it can start at the beginning of the heap and append - when compacting it needs to keep track of where each pointer will end up at after compaction, so that it can then correct those in every field of every object. Does it just use a hashmap from pointer to pointer for that ? What if I have a huge amount of very small objects on the heap ? Wouldn't that hashmap use more memory than my objects ?...

✅ map structure for my exercises

Yo guys, i try to make a map structure for all my exercises i get from my course but i dont know how it works. I did it before with python but that is lot different than with c#. Does anyone of you can help me fix this so i can work organized. I use visual studio code.

App to Google App Store

Hello, is there anyone here who speaks German and could help me upload our mobile app to the Google Play Store?

✅ How to Implement Blazor Web App Authentication and Authorization Using JWT with Auto Render mode

Hi everyone! I'm working on a Blazor web app and I need a detailed tutorial on implementing authentication and authorization using JWT (JSON Web Tokens). Specifically, I'm looking for guidance on: Setting up the authentication flow...

Math.Round issue

I have strange issue with Math.Round in a first example I use it to round a double after calculation, and the output wrong, because it has to have 2 digits after dot, but the output have more digits after dot. string input = Console.ReadLine(); double r = double.Parse(input); const double pi = 3.14;...

My views are not connected

In my application's main page, I am calling different views. Two views that are displayed side by side should interact with each other. When I add a task, it should appear in the ListView in the other view. Also, when I select a task from the ListView, the details of the selected task should be visible in the editors so that I can edit them. I have connected both views to the same ViewModel in their respective classes, but they are not working synchronously. When I add a task, I need to close an...

✅ IIS?

Soooo.. i tried to run my ASP.NET project and rider threw an error i had never seen before. It said i had to set up IIS. i though what the heck, you didn't need this 20 min ago. but I clicked the link to the settings and followed the instructions. I think i installed iis, then i wanted me to install ASP.NET Core module. I clicked the doc page and, found the Microsoft link for the install, rebooted and i am done....

✅ NodaTime JSON Serialization

Hello, .NET will parse any date format to DateTime or DateTimeOffset, but what happens if I give NodaTime control over the serialization? Assuming I accept an Instant in the DTO and a request comes in, but the format is not ISO-8601, will it be able to convert any type of date like .NET does, or will it only work with strict types? ...

✅ using Logging with ASP.NET

ASP.NET has a logging service. It looks way better than mine. I believe it gets set up here: ```cs builder.Logging.ClearProviders(); builder.Logging.AddConsole();...
No description