C
C#13mo ago
TheDucklord

❔ ✅ Program crashing outside of dev environment.

Hey all. Thank you all for creating a community like this. I very much appreciate that I can ask questions here. Hopefully someone has come across this before. I've been trying for weeks to figure this out.
So wha'ts happening is that a program I wrote works fine when building and running it from inside VS, but once I release it, or try to run the debug version outside of VS, it dies at a specific line of code. It seems to be here... HttpResponseMessage httpReply = await client.SendAsync(request); This is what request is HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url); request.Content = new StringContent($"client_id={clientId}&client_secret={clientSecret}&code={authCode}&grant_type=authorization_code&redirect_uri=http://localhost:3000"); request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/x-www-form-urlencoded"); Works 100% when running from VS, but outside, fails right there. has anyone seen this before or knows how to get this fixed? Would really appreacate this.
15 Replies
phaseshift
phaseshift13mo ago
Generally need information about the 'crash' to help more
TheDucklord
TheDucklord13mo ago
I'm sorry, I'm still fairly new to all of this ,and self taught. The program just disapears. It gives no errors or anything. that's what makes it so hard to figgure out what is going on. Since it's not in VS there's no debug information either. Is there some way I could get more information?
phaseshift
phaseshift13mo ago
Install windbg and attach with that You can still attach studio to the running process btw So there's a couple options
TheDucklord
TheDucklord13mo ago
okayI'll try those things and get back here, thanks! So I ran windbg and when I started the process that crashes things, I got this...
phaseshift
phaseshift13mo ago
That's just stopping when first attached You need to continue
TheDucklord
TheDucklord13mo ago
Okay I got it.. here's the whole thing. after it starts to crash
phaseshift
phaseshift13mo ago
Looks like you don't have permissions for something What files are you trying to read to or write to? Also please use $paste instead of attaching
MODiX
MODiX13mo ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
TheDucklord
TheDucklord13mo ago
okay cool, I'll start doing that. i'ts not reading or writing to anything. not during that. the program does write to a settings file but not anywhere where it's crashing. unless that HttpRequest does some reading/writing that I"m not aware of.
phaseshift
phaseshift13mo ago
Do you know what AVolute is?
TheDucklord
TheDucklord13mo ago
no, I do not. from a google search tehy are audio drivers? my program doesn't even use sounds. and the crazy thing is that it works flawlessly while debugging from VS but crashes only when you try running the exe outside of VS.
phaseshift
phaseshift13mo ago
are you running the same exe when running 'outside vs', or is it being published? same machine? What are the details on this?
TheDucklord
TheDucklord13mo ago
yeap same .exe, same machine. quite literally going into the debug folder and just double clicking the exe rather than building it and testing it from VS. I'm sorry, I don't think this is solved. The program is still crashing, and I'm not sure how to fix it. Correction, I did solve the problem and it was quite strange indeed. So I was going to make a minimal replicaiton of the issue. A seperate program with just the issue in it. Thing is, I couldn't. When I separated the code, it worked. Even outside of VS. Turns out, it was where I was excecuting the code from. It didn't like that it was buried under a couple of threads. So I just moved where I excecuted the code and poof. Started working.
Accord
Accord13mo 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.