C#

C

C#

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

Join

✅ How to clean up a stream of incomplete JSON data?

I'm working on adding some discord capabilities to a bot I'm working on but the data I get is really messy? I seem to just get a constant stream of data but I don't see any actual identifier of when a message ends? So I was wondering if there is any way that I could possibly keep adding a buffer to a StringBuilder and then try and extract the first json object, add it to a Channel and then remove it from the StringBuilder and keep looping it? This is 2 bits that I was working on so far.. I've cut out a lot of stuff that didn't work...
No description

✅ I keep getting the "build failed" prompt.

Not sure why this is but from my end all the files are correct and they worked before. But now I can't run any of the files when I debug.
No description

Does Polly WaitAndRetryAsync() swallow exceptions during retries?

Does Polly "swallow" the exceptions during each retry attempt?

✅ Implementing IAsyncLifeTime difference

When I implement the interface, the following happens as you can see in the picture. Why does the dispose not get set to public and have the extra IAsyncLifeTime.DisposeAsync ? I do not have any other DisposeAsync in my class?...
No description

Does not dash

Hello I have a player script, and I am trying to make a dash ability, but when I press the button nothing happens. I put a debug to see if it printed something and it did, but it doesn't accelerate my player or o anything, I also set variables in the inspector...
No description

✅ Integration testing

I just watched this video, and instead of seeding his database he is using a Faker class which generates the data. How does this work? Within he is using a CustomerRequest is this basically his DTO object? Before watching his video my approach in Integration Tests was: Seed Database...
No description

error when trying to run aot compilation with my package

i get this error when i try to compile a project which has my package added what can i do in my package to make it compile?...
No description

Asp.mvc I can't delete an item

I can't seem to get this working as intended, it's not showing me the screen for deleting an item. Any fixes?

level system

im pretty new to c sharp so excuse me for not being hte best technically but i was thinking of different ways to implement a level system and was confused on which to use? at first i wanted to try use an interface of ILevels as each level will have maxgems / a maxtiemr but these values will be different for each level but i cant assign variables in an interface so would i just make a class of levels? and make attributes?

Dynamic parsing different document types from Elastic Search

I am trying to fetch documents with different types of fields and nested fields from elastic search using NEST SDK and I am having issues parsing the documents into their appropriate types for example YoutubeVideo or TrelloCard which have different fields and structure. I am doing a free text search across all fields for the different types of documents in a single index and want to dynamically map them to specific C# model class for example Class TrelloCard. I have tried using Generics, pattern matching and so on. However I am unable to return the Source object eg. TrelloCard or YoutubeVideo from my search method. The JSON search result from Elastic search looks like this for the YoutubeVideo document type and the document data that I want to extract and parse is in the "_source" object: ...

Help on defining aggregates using DDD

Hi, I'm working on a mini project for a spa management system in which I would like to familiarize myself with the concept of DDD (Domain-Driven Design). I have a general understanding of it, but I'm having trouble defining what should be an aggregate and what should not. Currently, I anticipate having the following classes in the system: Employee, Customer, Service, Salon, Product, Appointment, Sale, Invoice, Report, Schedule, Payment. Could someone guide me on which classes should be aggregate...

compilation fails when using -s ASYNCIFY=1 in browser-wasm project

i have set following linker flags for emscripten: <EmccExtraLDFlags>-s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY=1</EmccExtraLDFlags> -s ASYNCIFY=1 causes compilation to fail: https://hastebin.skyra.pw/biducidima.nginx csproj file: https://hastebin.skyra.pw/enalazogik.htm...

✅ NuGet package doesn't exist in current context

So I recently just installed a NuGet package and tried to call(? idk what to call it) a "function" of the NuGet package I installed but it says that it doesn't exist in the current context, I don't really know how to explain it better but the screenshots can. Please take a look
No description

✅ Missing parameter setter in System.dll

if I can't call ctor from base class, because its missing param setter (and cant go any further with F11), what should I do? That's not problem of my machine, cause others got same results

✅ Guidance and Mock Interview Required

Hi, I have some experience in .NET and C# but its quite limited to REST APIS, ASP.NET and ENtity Framework. I would greatly appreciate if someone guides me and takes a mock interview for me. Please DM ME...

✅ Why is this different I cant figure this out

if i remove the circled code the e will pop up behind Skibidi and ruin it but the write line should make a new line for it but it doesnt and needs an empty writeline how does this happen please help
No description

✅ HttpClient Base Address Null in Blazor WASM

I have a Client class that was generated by NSwag Studio. I'm setting the client base URL in Program, but when I reference it in a component, the BaseAddress is null. The screenshot is using the HttpClientFactory, but even just injecting the Client directly, it's still null. What am I doing wrong here?
No description

Concurrency Failure while updating user in UserManager

Hi. After adding new item in List<RefreshToken> in user entity and update it in UserManager.UpdateAsync() im getting error "Optimistic concurrency failure, object has been modified". I have searched a lot of things, tried, but no way to fix this error.... C#...
No description

Changing the default css for Identity pages in a Blazor Server app

Is it possible to change the default css for the Identity pages in a Blazor server app? I'm pretty new to Blazor, coming from Razor, I'm not sure why this is so complicated?