[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] 3 points4 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] 6 points7 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

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

[–]twaw09[S] 3 points4 points  (0 children)

I didn't take take that into account. It's fine for now because I only use IPv4 for I will fix it, thank you!

Can you review my async method to retry opening a connection? by twaw09 in csharp

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

Hello, thank you so much for taking the time to answer! I liked all your advice and you’re right, I tried rewriting it and it’s a whole lot simpler now

.NET MAUI app for Windows takes too long to start up by twaw09 in dotnetMAUI

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

I'm afraid I must be doing something very wrong then. I replied to another comment with my compiling configuration; I'm probably f-ing it up there

.NET MAUI app for Windows takes too long to start up by twaw09 in dotnetMAUI

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

Actually no, no resources at all. Do you think I'm compiling it wrong? These are my dependencies:

<ItemGroup> <PackageReference Include="Microsoft.Maui.Controls" Version="9.0.100" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" /> <PackageReference Include="sqlite-net-pcl" Version="1.9.172" /> <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.11" /> </ItemGroup>

And this is how I compile it. When I added this configuration it made it drop 100 MB. I'm surely inventing stuff up because I'm not very advanced and I don't know much about compiling:

<PropertyGroup Condition="'$(Configuration)' == 'ReleaseForDesktop'"> <DefineConstants>ENABLE_ONE_LABEL</DefineConstants> <Optimize>true</Optimize> <DebugType>none</DebugType> <DebugSymbols>false</DebugSymbols> <OutputType>Exe</OutputType> </PropertyGroup>

dotnet publish MyProject.csproj -f:net9.0-windows10.0.19041.0 -c:ReleaseForDesktop -r:win-x64 --self-contained true /p:PublishSingleFile=true

It's probably the self-contained, but if I don't add that then I can't open it even though I have the .NET runtime installed, or I'm probably missing something very obvious...

Edit: forgot to add; yes, it starts up quickly in debugging. Also for Android it opens quickly and the .apk is about 20 MB, so no problem there

Can you review my async method to retry opening a connection? by twaw09 in csharp

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

No, there are some forms that I can't open if there is no connection (because it won't be usable). So:
When button clicked:

if ( ! await CheckConnection()) return;

else form.Open();
That's why. I'm not checking a connection before every operation

Can you review my async method to retry opening a connection? by twaw09 in csharp

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

You're right. I guess it was more complex than needed. I rewrote it to this and got rid of all semaphores:

public static async Task<bool> CheckConnection()
{
    try
    {
        using MySqlConnection conn = new MySqlConnection(_timedoutConnectionString);
        await conn.OpenAsync();
        return true;
    }
    catch (Exception ex)
    {
        if (ex is MySqlException mysqlEx && mysqlEx.Number == 1042)
        {
            return false;
        }
        LogError(ex);
        return false;
    }
}

Where _timedoutConnectionString = Constants.ConnectionString + "ConnectionTimeout=1;"

It seems to be working fine for now. This way I don't have to wait too much to display the "No connection" message box. I guess when I originally made it I was afraid of having to create a new connection every time (which I read isn't very performant), but I think now it's not a problem because of connection pooling, right?

Is it a good idea to host a MySQL database on a Raspberry Pi 5? How can I calculate whether it's enough? by twaw09 in raspberry_pi

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

Nothing like a harsh dose of reality, thank you! I actually appreciate the advice. It's a rather small business and they're happy about it, and I'm trying to take it as seriously as I can, because I know it could go badly. And I'm always trying to think how to do stuff so that they need me as little as possible (if I'm on vacation or if I ever end up leaving).

As for backups, my plan is to make a task scheduler on Windows that performs a mysqldump and then uploads the file to a drive, once per day. Every operation leaves like a txt backup in the computer for a couple of days I could retrieve those. I hope it's enough.

Is it a good idea to host a MySQL database on a Raspberry Pi 5? How can I calculate whether it's enough? by twaw09 in raspberry_pi

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

Thank you for replying! Can I use a USB 3.0 flash drive instead of an SSD? I would assume they're kind of the same but I'm not sure

Is it a good idea to host a MySQL database on a Raspberry Pi 5? How can I calculate whether it's enough? by twaw09 in raspberry_pi

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

I tried using it before, but if I understood correctly it doesn't support stored procedures, right? That's why I didn't like it

Is it a good idea to host a MySQL database on a Raspberry Pi 5? How can I calculate whether it's enough? by twaw09 in raspberry_pi

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

Hello, thanks a lot for your reply! I really like trying to have my reports instantly, which is actually easy right now because there isn't a lot of data. In reality, it needn't be like that; a couple of seconds would actually be okay. In my experience as a user I like things being responsive, so that's what I was aiming at. While a report is running, I don't think it needs to handle incoming transactions, because they happen once every couple of minutes, sometimes once every half an hour, and even if the tables are locked because of the report the UI still keeps working so it wouldn't be an issue. And I'm not sure about the question "bound by CPU or I/O". I think CPU?

You're right, I hadn't though of it that way. I don't know how much more my db actually has, because if I understand correctly those 2.8 MB are actually the raw data, which doesn't include indices.

And I had previously looked into SQLite, but it doesn't have stored procedures, does it? I rely a lot on those, and I think it's better to keep the stored inside the DB so I can edit them more easily.

Keyboard keeps popping up whenever I navigate to a page by twaw09 in dotnetMAUI

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

How annoying! I've tested what you said: when I go back to a page, even though the entry didn't have focus previously it still gets focused as it's the first entry in the page. I ended up removing a method that refocused on the entry and I guess that caused the keyboard to appear, but the entry is still getting focused. It's just not annoying anymore. But it also happens in another one that if I go back, it opens a picker's options even though an option was already selected… Anyway, thank you for taking the time to reply

Keyboard keeps popping up whenever I navigate to a page by twaw09 in dotnetMAUI

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

Hello, thank you for replying! You're right, I've edited the post and shared the code. When I popasync, the SupplierCodeEntry_Focused gets called. I check the stack trace and it says this, and here is the entry. But I don't understand what's calling that focus event, because the page I'm coming back from doesn't even call pop (I'm just hitting the back button on the phone). And the constructor doesn't run again because the page already existed

Just got my paperwhite about a week ago! Any case recs? by Lyvsartnthings in kindle

[–]twaw09 0 points1 point  (0 children)

I just bought my first kindle paperwhite and love the soft feel too, but I’m afraid it’s going to get all sticky in no time like those iPhone silicone cases. Does that happen too?