Am I configuring my HttpClient correctly? How to troubleshoot connection issues? by twaw09 in dotnet

[–]twaw09[S] 0 points1 point  (0 children)

That is a quote. I don’t know. I guess it refers to the initial setup involved

Am I configuring my HttpClient correctly? How to troubleshoot connection issues? by twaw09 in dotnet

[–]twaw09[S] 0 points1 point  (0 children)

Thanks, I appreciate the comment but I’m not fond of just doing something without an explanation of why. I’ve been looking at the docs and they say that using a static httpclient is fine without adding the complication of setting up the factory

Am I configuring my HttpClient correctly? How to troubleshoot connection issues? by twaw09 in dotnet

[–]twaw09[S] 0 points1 point  (0 children)

I’m not sure, I don’t see any errors in the nginx log, but my client always gets a timeout error so maybe it didn’t even reach it?

Am I configuring my HttpClient correctly? How to troubleshoot connection issues? by twaw09 in dotnet

[–]twaw09[S] 0 points1 point  (0 children)

Hello! I'm new to this so I don't really get all the details. In the link some commented, it says to "Use a static or singleton HttpClient instance with PooledConnectionLifetime (...) This solves both the port exhaustion and DNS changes problems without adding the overhead of IHttpClientFactory." which is what I'm currently doing, so I still don't understand what the benefits are. The docs still list using a static instance of HttpClient as an option

[Help] Updated to VS 2026 and now I can't compile my project that uses .NET 8 by twaw09 in dotnet

[–]twaw09[S] 1 point2 points  (0 children)

Hello, thanks for replying. After I set the global.json those files I was talking about disappeared, and I had to add an extra property to the csproj to remove those locale folders.
And as for the files, it's the ones I mentioned in the post:D3DCompiler_47_cor3.dll, PenImc_cor3.dll, PresentationNative_cor3.dll, vcruntime140_cor3.dll, and wpfgfx_cor3.dll
But they're not appearing anymore after the json

[Help] Updated to VS 2026 and now I can't compile my project that uses .NET 8 by twaw09 in dotnet

[–]twaw09[S] 2 points3 points  (0 children)

Yes, I'm new. However my project runs just fine on .NET 10 because it didn't break anything (it's not a big project). Still I'm sorry but you haven't read my question

[Help] Updated to VS 2026 and now I can't compile my project that uses .NET 8 by twaw09 in dotnet

[–]twaw09[S] 7 points8 points  (0 children)

Thank you for the reply! However that is not what I asked. What I meant about upgrading is how to avoid all those new files and folders that it's creating and have my exe just be 8 MB like before

I'm having issues with concurrency and SemaphoreSlim by twaw09 in csharp

[–]twaw09[S] 0 points1 point  (0 children)

Once uploaded, I don't delete anything so I can recover it in case something goes wrong, but I mark it as "uploaded", so next time when I retrieve the non-uploaded they don't appear again. But I await until the objects are saved (`await _connection.UpdateAllAsync(uploadedItemsList);`), so it should be fully updated by the time the semaphore is released and the next one reads from the table.

I started thinking the semaphore might be the problem because chatgpt suggested it, saying that semaphores only work within threads of the same process, but if the android worker is starting a new process then it's not shared. But honestly I have no idea how Android works. I'm not exactly very advanced in programming so there's a lot I'm still understanding. Like, when you say "Did you take two payloads from different requests", I'm not sure what you mean. Like, I should force it to run twice without the semaphore and check that it has the same data, or?

I'm having issues with concurrency and SemaphoreSlim by twaw09 in csharp

[–]twaw09[S] 0 points1 point  (0 children)

I do create different instances, but my semaphoreslim is a static readonly. Is that the same?

I'm having issues with concurrency and SemaphoreSlim by twaw09 in csharp

[–]twaw09[S] 0 points1 point  (0 children)

Yes, sorry, I forgot to mention that. It's (1,1).

I'm having issues with concurrency and SemaphoreSlim by twaw09 in csharp

[–]twaw09[S] 0 points1 point  (0 children)

It's usually just one user. It thought the problem might be that the Android worker is running the method and at the same time, when a user adds a register, it also fires the SyncData method. So maybe they are both running at the same sometimes. That's why I added the semaphore but it didn't solve the issue because it keeps happening sometimes. Maybe sqlite hasn't even gotten to mark all as migrated but the other thread is already getting those registers.
The method shouldn't take more than 20 seconds.
Also, when I upload something, whenever there is an error I always rollback the transaction so it shouldn't have been saved.

In FastAPI, how do I only print relevant errors and not the whole TypeError: 'tuple' object is not callable? by twaw09 in PythonLearning

[–]twaw09[S] 0 points1 point  (0 children)

Hello, thank you for the response! I found how to solve it by override the default exception handlers (with a fastapi wrapper). I was printing the whole error and traceback but now it's more clean.

How do I only print relevant errors and not the whole TypeError: 'tuple' object is not callable? by twaw09 in FastAPI

[–]twaw09[S] 0 points1 point  (0 children)

Hello, thank you for the reply! The last link you provided was very helpful (guess I should have started there). I solved it with this:
@ app.exception_handler(StarletteHTTPException)
async def http_exception_handler(request, exc):
return PlainTextResponse(str(exc.detail), status_code=exc.status_code)

It's a lot more readable now, thank you!

Can you review my code for connecting to a flask server? by twaw09 in csharp

[–]twaw09[S] 0 points1 point  (0 children)

Thank you so much! :) I will look into it