Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

ljw1004 posted:

Oh! It looks to me like it will do what the comment claims... Could you talk through your reasoning?


Not the op, but what I think happens is: the runtime calls dispose right before garbage collection. It doesn’t know to wait for the thread to complete. Race condition ensues, program blows up.

Adbot
ADBOT LOVES YOU

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
Maybe, but the op mentioned in this, or another thread that his service was crashing intermittently with an exception related to dispose, and he said he tracked it down to this method. My guess is some kind of race condition.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
You could just use a Tuple as a key and have one dictionary.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
Why don’t you just import the certificate you’re using into the system certificate store? Chrome should then trust it by default.

Alternatively, I think there’s a way to launch chrome in an insecure mode. Google tells me —allow-running-insecure-content. You could try that.

Jen heir rick fucked around with this message at 03:52 on Apr 7, 2020

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

NihilCredo posted:

This. His code is fine, or close enough. The problem is that he's testing it using Swagger (I assume he means Swagger UI), which doesn't have a file upload button, just a text field that becomes the request body.

Test the API with something like Postman and you'll be able to attach actual files to the request.

You can get swagger ui to display a file button with the right annotations, but it requires a bit of futzing about depending on what version of swashbuckle you’re using. Assuming he’s using swashbuckle.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

Revalis Enai posted:


My local server shows a status code of 200 ok while the live server is showing status code 302 found

302 is a redirect, look at the response header and see what it’s trying to redirect to.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

Revalis Enai posted:

I looked at the header for Clear.aspx from both sites and only the live server shows a location
code:
Location: /errorpage.aspx?aspxerrorpath=/Tools/ShoppingCart/Clear.aspx
I'm not sure what it means, but I'm guessing that something happened while executing Clear.aspx and it's generating an errorpage?

It’s trying to redirect to an error page, but Ajax calls won’t follow redirects. You should try making the same call using Postman.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

Supersonic posted:


Is there a better way to do this?

I don’t think you need to create a new thread. I looked at the Naudio example for winforms, and they aren’t creating a new thread with Task.Run, they just call Play and subscribe to the playback stopped event to dispose of the outputDevice. You should do something like that.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

LongSack posted:

Was not aware. I will adjust my behavior accordingly. I just started using Dapper after long-running frustrations with EF Core.

Is there a way using MS SSMS to see all incoming queries? I think I might want to check some other parts of the code to make sure that what I think is hitting the database is actually hitting the database.

You can use Sql Server Profiler to see requests happen in realtime. But also, Dapper does not work this way. The way you can tell is if the method returns an IQueryable. QueryAsync returns an IEnumerable. Which means that all of the results are returned in one go and held in memory.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

insta posted:

That is absolutely not how IQueryable or IEnumerable works.

It's not? How so?

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
I don't see how all that contradicts what I said.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

insta posted:

Because you said it holds it in memory, and unless you specifically tell Dapper to do that, Dapper will instead return the items one-by-one from the database reader instead of holding them in memory.

I see what you mean. What I meant was that it holds onto the values once you iterate over the IEnumerable and does not retrieve them from the database again. I just tested this by calling QueryAsync and then iterating over the result set twice. I had Sql Server Profiler running and it only recorded a single query to the database. I don't think that code you posted is correct. I dissasembled the code using Linqpad (Linqpad allows you to jump right to the definition of a method) and it looks like it is executing a reader and holding on to that. Maybe I'm using a different version.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

insta posted:

Check the underlying return type of the object, if you can. Dapper has a Buffered option that will fill a List and give you the List, which can be iterated over repeatedly without a second query, but it's still IMO dangerous in that flipping a boolean somewhere can cause multiple queries to start executing again.

Just checked this. It is returning a List object whether or not you specify the Buffered option or not. If you do not pass in Buffered=true then upon the second iteration you will get the error: Invalid attempt to call Read when reader was closed. Additionally the query is executed as soon as I call QueryAsync. Not upon iteration. When you iterate it's just calling the data reader methods. I also made sure I'm using the latest version of Dapper.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
You can also use the Timer class to raise an event every n seconds.

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
I don't know how these open source guys do it. I have little patience for bullshit. The first time somebody opened an issue and got snippy with me I'd be like "Ok, I'm out. Good luck with this". Or maybe I'd amend the license to ban that person in particular from using it. I'm not good with people.

Adbot
ADBOT LOVES YOU

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off

CapnAndy posted:

Yeah, I know. I'm specifically wondering if I should do a hybrid app because it's likely that Microsoft will put more pressure on in the future to turn everything into Blazor -- because, like I said, I can see the benefit of literally everything being one codebase and they'll just compile it differently for us. If they're gonna, I'll go with it, but if they're not gonna, I really don't want to.

I hate writing web apps and wish I could write native apps, but it seems like the world is moving to hybrid/web type apps. The economics are just too good. You can have a single team write an app that works on android iOS, macOS, Linux, and windows. You just can't beat that with native apps. You need a team or developer for each platform. The suits just aren't gonna pay for that. Even if the result is a shittier experience. People will get over it. poo poo sucks yo.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply