• 0 Posts
  • 15 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle




  • The problem with blazor as I understand it, is that no, it does not compile your C# into WASM. Instead, it compiles into a standard .net module – with as much excising of unused code as possible – and distributes it with a CLR that is compiled to WASM. So effectively you’re running the .net VM inside the WASM VM. If you do client-side blazor, which is not even MS’s push anymore because they stand to make more money if you write server-side blazor and deploy it to Azure.

    Do look it up yourself tho. I could have a totally wrong understanding. I haven’t looked into it in some time because I’ve not been in a position to start a new frontend project from scratch. I would love to do my frontend stuff in C# though, don’t get me wrong.








  • My old boss loved VB.Net. I still remember a time when I helped him out by solving mysterious bug for him.

    He used to have this class he copied about to do database stuff. Not the worst thing of itself, but it was oddly specific in some ways for reused code. E.g. It had a function that took an enum value and returned connection string. And of course what options were in the enum varied.

    So I come in one day and two other devs are already peering over his shoulder trying to help. The program is crashing when it tries to connect to the database and they can see for some reason the connection string is a single letter. I ask to see the function that is getting the connection string and see he’s removed the parameter, but the compiler didn’t pick up on it because:

    • VB.net lets you call functions that have no parameters without parentheses
    • VB.net is type lax, so an enum can be treated as an integer without casting
    • VB.net uses parentheses for array indexation as well as method invokation
    • .Net strings can be indexed like an array of characters
    • VB has no character type so VB.net treat characters as 1-length strings

    So instead of passing an enum to a function, it was calling the function with no parameter, then using the enum value to index the returned string into a single character, which was then treated as a string and passed to the SqlClient constructor.