Blazor WASM project has logic error involving data fetching

Hello there! I'm developing a web app/educational game that is meant to teach migrant workers about labor related bureaucracy in a manner they themselves would encounter it in real life. This basically is a full stack project and it seems I'm having considerable issues with getting the app to work, which is related to the api connectivity. The app connects to an API that works as an intermediary component between the web app and translation service, as well as a database of past queries since it's bit wasteful to re-translate same stuff to same languages every time. This API works as intended when it is tested with curl and Swagger. The issue comes with the web app, which, when I try to feed it with the translation query, has an unexpected error. Basically, what happens is that the used thread for the async method is busy when the app tries to fire it, since, for some weird reason, it is processed twice, with the second runaround leading to the error and thusly instead of getting translated query, the app gives me an error and asks me to reload the page. As you can see from the image, apparently there's some sort of "Memory Out of Bounds" issue going on. I have attached screenshot of the console printout, the .razor file and dev server printout to this message.
42 Replies
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
I mean it is in use because that's where the web app runs. Isn't that how it's supposed to work?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
I see. How this can be fixed then? I'm genuenly curious since I think changing the address from launch options, which is the most obvious solution, would just result this issue happening again on that new address
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
I'm not sure what could cause it but I'll take look at the launch settings. It's still pretty confusing tough. If what you say is true then that would mean that rider starts 2 instances of the app when I debug or otherwise run it
MODiX
MODiX11mo ago
TeBeCo
netstat -ano | findstr 7264
React with ❌ to remove this embed.
Blizzie the Mare
Blizzie the MareOP11mo ago
I'm sorry but uh, this is honestly more confusing than helpful.
Angius
Angius11mo ago
Execute this command in the terminal to see which application takes up port 7264
Blizzie the Mare
Blizzie the MareOP11mo ago
Ah. I see. I'll do that tomorrow! Thank you for the clarification Here's the results I get when I run the web app withouth debugging on the machine
user@computer:~$ netstat -ano | grep 7264
tcp 0 0 127.0.0.1:7264 0.0.0.0:* LISTEN off (0.00/0/0)
tcp 0 0 127.0.0.1:36152 127.0.0.1:7264 ESTABLISHED off (0.00/0/0)
tcp 0 0 127.0.0.1:7264 127.0.0.1:36152 ESTABLISHED off (0.00/0/0)
tcp6 0 0 ::1:7264 :::* LISTEN off (0.00/0/0)
tcp6 0 0 127.0.0.1:36140 127.0.0.1:7264 TIME_WAIT timewait (50,38/0/0)
user@computer:~$ netstat -ano | grep 7264
tcp 0 0 127.0.0.1:7264 0.0.0.0:* LISTEN off (0.00/0/0)
tcp 0 0 127.0.0.1:36152 127.0.0.1:7264 ESTABLISHED off (0.00/0/0)
tcp 0 0 127.0.0.1:7264 127.0.0.1:36152 ESTABLISHED off (0.00/0/0)
tcp6 0 0 ::1:7264 :::* LISTEN off (0.00/0/0)
tcp6 0 0 127.0.0.1:36140 127.0.0.1:7264 TIME_WAIT timewait (50,38/0/0)
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
Ah, no problem, it's easy mistake to make because a lot of .NET development happens in Windows ^^
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
Fair enough. At least I know what to do if I have to work on windows machine
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
hmm, I ran this again, and there's 4 dotnet Connections on Active connections collumn, 2 them in the port 7264, but one is ipv4 and other is ipv6. Active Unix Domain Sockets has only one instance of dotnet entry listed.
Blizzie the Mare
Blizzie the MareOP11mo ago
here's hte complete printout
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
I'm still get an error. I'll try this again with a debugger on
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
Right, so I should specify different port for api and the app? Well here's the thing tho: launchsettings.json have different ports specified for both api and the app. API uses 7046, app uses 7264. And I run them both from rider. Unless I should specify additional port for the app to use for client connection and other for api connection as well. I.E. App should ose 7264 to connect to browser client whilst it uses 7265 for the api for example? Plus launching and shutting down the program from Rider doesn't seem to leave any ghost dotnet processes behind
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
I allready have actually Just give me the email or github user name so I can inv
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
It's not Inv sent
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
I have an API too, but that seems to be working withouth an issue when I tested it both with and cli test application and with grep I just realized I should've invited you to that too since it's crucial for testin >.< there, the right branches I'm currently working on are api_fork for Blazetranslate and DB_implementation for api_translate
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
yes, no worriers
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
how on earth? Because even in IDE it seems that there's two different ports set up a moment, I'll take a screenshot
Blizzie the Mare
Blizzie the MareOP11mo ago
first one is environment variables for the api_translate and second are for BlazeTranslate. And when I launch it from rider it only launches one instance
No description
No description
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
Well then, this shit just keeps getting ever so confusing
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
No Only using eithet VS or Rider to run it.
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
still "memory access out of bounds" error sorry for the late response, I was bit preocupied yesterday
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
Will do. Think it has something to do with the fact that pressing the button that fires the data retrieval function twice in the succession or something And I think async method shouldn't do it this one to be spesific
//Send query to TranslateService and get result
async Task HandleSubmit() => result = await Http.GetStringAsync(string.Format("https://localhost:7046/api/translate/{0}/{1}/{2}",
TranslateQuery.Text, TranslateQuery.SourceLanguage, TranslateQuery.TargetLanguage));
//Send query to TranslateService and get result
async Task HandleSubmit() => result = await Http.GetStringAsync(string.Format("https://localhost:7046/api/translate/{0}/{1}/{2}",
TranslateQuery.Text, TranslateQuery.SourceLanguage, TranslateQuery.TargetLanguage));
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Blizzie the Mare
Blizzie the MareOP11mo ago
Fair enough Okay hmm... I might have one theory why this might happen The thing is, since I am running this thing in localhost environment. Both the app and server where it loads the app into the browser occupy same port. Resulting in error. Do you think this might be the possibility? After all, web assembly means that the app is first loaded from server and then runs completely on the host device withouth any interaction with the server that originally hosted the app, meaning it can be run withouth internet connection after the initial load for example
Want results from more Discord servers?
Add your server