C
C#2y ago
Elmishh

❔ [FIXED] C# console app as .EXE problems

my C# consoleapp breaks on second use but works just fine on first use/when opened through VS2022
32 Replies
Elmishh
ElmishhOP2y ago
On first use
Elmishh
ElmishhOP2y ago
On second use
phaseshift
phaseshift2y ago
That is very difficult to diagnose without code. Suggest you $debug
MODiX
MODiX2y ago
Tutorial: Debug C# code - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
Elmishh
ElmishhOP2y ago
GitHub
live-updating-compost-profit-checker/Program.cs at main · Elmishhh/...
uses api to calculate profits on the compost in hypixel skyblock, just follow the instructions - live-updating-compost-profit-checker/Program.cs at main · Elmishhh/live-updating-compost-profit-checker
Elmishh
ElmishhOP2y ago
Heres the source And an install Its terrible code Because i suck at coding
phaseshift
phaseshift2y ago
webclient is outdated - use HttpClient
Elmishh
ElmishhOP2y ago
Is that the cause for the issue?
phaseshift
phaseshift2y ago
doubt it if your problem is line 1210 which is just writing to console?
Elmishh
ElmishhOP2y ago
?
phaseshift
phaseshift2y ago
you're saying line 1210 doesnt work
Elmishh
ElmishhOP2y ago
No im saying the whole thing breaks on second use : becomes a lot of spaces Second time i launch the .exe Per time i download it
phaseshift
phaseshift2y ago
looks like theyre writing concurrently or something
Elmishh
ElmishhOP2y ago
? You can download it and see for yourself if it helps
phaseshift
phaseshift2y ago
no thanks
Elmishh
ElmishhOP2y ago
Ok Wdym here tho
phaseshift
phaseshift2y ago
multiple things writing to console at the same time how do you run it the first time, how do you end the first process?
Elmishh
ElmishhOP2y ago
I click the X button How am i supposed to close it
phaseshift
phaseshift2y ago
I don't think its anything to do with being the second use then I don't see how a killed process can interfere with the second
Elmishh
ElmishhOP2y ago
So with switching to HTTP should i just change the start of using webclient and client.downloadstring to
HttpClient client = new();
var response = await client.GetAsync(url);
HttpClient client = new();
var response = await client.GetAsync(url);
phaseshift
phaseshift2y ago
you should use the same httpclient everywhere, not make a new instance each time (or useHttpClientFactory) I don't know whats going wrong with your output to console, though
Elmishh
ElmishhOP2y ago
Maybe its caused by having so many warnings?
phaseshift
phaseshift2y ago
no
Elmishh
ElmishhOP2y ago
Idk how warning would affect second launch This is weird Does anyone know? Anyone?
phaseshift
phaseshift2y ago
suggest you debug it
Elmishh
ElmishhOP2y ago
How
phaseshift
phaseshift2y ago
$debug
MODiX
MODiX2y ago
Tutorial: Debug C# code - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
Elmishh
ElmishhOP2y ago
Yeah but it only happens when using a .exe, how do i debug the .exe
phaseshift
phaseshift2y ago
when you run it from studio/debugger, its running the exe Also you can attach to running processes
Elmishh
ElmishhOP2y ago
it doesnt work per time i run it on pc restart(per folder) it works for the first time and then is broken after why is that happening and only when using directly the exe can anyone please help i just want it to run normally is newtonsoft the problem? i doubt it what can it be why is it on the second use only on the .exe and only fixes when i restart my pc 0-0 its the multi line variable OF COURSE IT IS /closeticket how do i close !close >:3 nope its every time i print a few lines at once well not a few
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server