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
JawnV6
Jul 4, 2004

So hot ...

Malcolm XML posted:

install http client libraries from nuget and use those https://www.nuget.org/packages/Microsoft.Net.Http

It's unclear to me how grabbing something else in an extra complicated way is going to make that new thing available on a remote computer I have zero control over and is already missing core functionality? Am I missing some bit about how this works?

Adbot
ADBOT LOVES YOU

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

JawnV6 posted:

It's unclear to me how grabbing something else in an extra complicated way is going to make that new thing available on a remote computer I have zero control over and is already missing core functionality? Am I missing some bit about how this works?

how are you deploying code to a server you have no control over? and who pissed in your cornflakes? nuget is standard for component delivery on .NET. clearly the application is linked against HWR or you'd fail at binding time as opposed to run time so fix your broken deployment by either sidestepping HWR or not using mono

JawnV6
Jul 4, 2004

So hot ...
I'm not using mono. The only error pages that popped up are in reference to mono. I'm clearly not explaining myself all that well, and I apologize for the tone. I don't want to explain the horrible delivery I'm papering over with "deployed" nor the environment this is running in so it's just X/Ying from here down.

I've tried rewriting it with WebClient instead of HWR, that's probably going to suffice for this round of onion peeling. Cheers!

ljw1004
Jan 18, 2005

rum

JawnV6 posted:

It's unclear to me how grabbing something else in an extra complicated way is going to make that new thing available on a remote computer I have zero control over and is already missing core functionality? Am I missing some bit about how this works?

I don't understand the error report

quote:

Method not found: 'System.Net.HttpWebRequest'
That's because HttpWebRequest is a type not a method. So it's confusing. We don't know whether the type exists, we don't know which method it's talking about, we don't know if it's an exception or some other kind of error, we don't know execution of which exact line of code causes this exception to fire.


One possibility is that there's a mismatch between the reference-assemblies that you compiled against and the actual assemblies on the target machine. Using the NuGet package Microsoft.Net.HttpClient would perhaps solve that because at least HttpClient would be packaged app-locally if needed, and you'd rely on the MS folks who wrote it to do the right binding on the target machine. I know that others of the MS NuGet packages do dynamic checks based on what runtime assemblies they actually load. (Also, HttpClient has a nicer API than WebRequest).


Another possibility, reading between the tea-leaves, is that you're making an entirely valid HttpRequest, and this is going to an ASP.NET server, and that server itself is returning some kind of error code, and you're properly surfacing that error. I don't know.


You're imaging the possibility that System.Net.dll is absent on the target machine, and that Microsoft.Net.HttpClient is a wrapper built around it. That's possible but seems unlikely because -- why would it be absent??

JawnV6
Jul 4, 2004

So hot ...

ljw1004 posted:

You're imaging the possibility that System.Net.dll is absent on the target machine, and that Microsoft.Net.HttpClient is a wrapper built around it. That's possible but seems unlikely because -- why would it be absent??

I'm looking at a screenshot from a factory floor. They might not have the latest/greatest setup there, but they have enough .NET to put a button on the screen so it hasn't been an issue so far.

I didn't close the single quote because the dialog didn't close the quote. I understand that the actual method isn't present in what I'm saying, that information is unavailable to me as well. I posted the entirety of the code, thinking that the single method call on that object would be enough information.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
This is pretty off the wall, but does anyone know if there's a keyboard shortcut in VS to move the location of a document tab? For example, let's say I have 10 files open and I'm looking at the 7th one. If I want to move the location of that tab, right now I have to grab my mouse and move the location manually. I'm looking to be able to use the keyboard to move it either backward or forward, or maybe just to the first position.

In Firefox, you can do this with Ctrl+Shift+PgUp/PgDown.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Bognar posted:

This is pretty off the wall, but does anyone know if there's a keyboard shortcut in VS to move the location of a document tab? For example, let's say I have 10 files open and I'm looking at the 7th one. If I want to move the location of that tab, right now I have to grab my mouse and move the location manually. I'm looking to be able to use the keyboard to move it either backward or forward, or maybe just to the first position.

In Firefox, you can do this with Ctrl+Shift+PgUp/PgDown.

If you've got multiple panels open you could do Alt + -, x (or r) then do it again in the reverse direction. That will land your panel on top of the stack that it started in. Bit of a mouthful though.

e: (Or do alt + -, v in order to pop it into a new group. Then popping it back to previous will kill the new group.)

e2: Playing with this now and it's not actually that bad. Hold Alt throughout, press -v-r, and the panel has moved to the top in its window.

Newf fucked around with this message at 17:54 on Feb 5, 2015

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
Neat, that's a pretty creative way of pulling that off. It lags a bit when opening a new panel, so the last R keypress doesn't necessarily get registered. I'll just have to slow down when I want to do that.

Thanks!

RICHUNCLEPENNYBAGS
Dec 21, 2010
Big git merges invariably break csproj files and it sucks. Do you guys have any strategies to deal with that?

Cryolite
Oct 2, 2006
sodium aluminum fluoride

RICHUNCLEPENNYBAGS posted:

Big git merges invariably break csproj files and it sucks. Do you guys have any strategies to deal with that?

I do that all the time but with TFS. Is it somehow fundamentally different in git?

My strategy is to do it very, very carefully, and merge as often as I can so the .csproj files don't diverge very much. I also yell at people not to refactor and move a bunch of files around in certain branches so the eventual merge doesn't become a mess. If the branches are planned well there aren't too many conflicts.

Merging a 10,000 line .sln file is also fun :)

RICHUNCLEPENNYBAGS
Dec 21, 2010

Cryolite posted:

I do that all the time but with TFS. Is it somehow fundamentally different in git?

My strategy is to do it very, very carefully, and merge as often as I can so the .csproj files don't diverge very much. I also yell at people not to refactor and move a bunch of files around in certain branches so the eventual merge doesn't become a mess. If the branches are planned well there aren't too many conflicts.

Merging a 10,000 line .sln file is also fun :)

Probably not; the problem is that the merge doesn't know about XML so it sees the same closing tag in two different documents and makes an invalid XML file.

aBagorn
Aug 26, 2004
Does anyone have any experience with Entity Framework in a load balancing environment?

And if so, what sort of pitfalls should I be looking out for with regard to db locking / results caching?

RICHUNCLEPENNYBAGS
Dec 21, 2010

aBagorn posted:

Does anyone have any experience with Entity Framework in a load balancing environment?

And if so, what sort of pitfalls should I be looking out for with regard to db locking / results caching?

Caching is a pain in the rear end with EF because the entities are attached to contexts. Cache values, not entities.

wwb
Aug 17, 2004

RICHUNCLEPENNYBAGS posted:

Big git merges invariably break csproj files and it sucks. Do you guys have any strategies to deal with that?

The trick to avoiding big, painful merges is to not have big merges. Stuff like rebasing the feature branches off of master is a good place to start.

That said, I've done a fair bit of merging of things and I've never had that much trouble with the project files -- the modern iterations are pretty clean and most changes are not that troublesome. What git client are you using to do the merges?

RICHUNCLEPENNYBAGS
Dec 21, 2010

wwb posted:

The trick to avoiding big, painful merges is to not have big merges. Stuff like rebasing the feature branches off of master is a good place to start.

That said, I've done a fair bit of merging of things and I've never had that much trouble with the project files -- the modern iterations are pretty clean and most changes are not that troublesome. What git client are you using to do the merges?

I just do it from the command line. I have a merge tool but the thing is most of the merges are successful; they just result in invalid XML.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
I can't think of a time where I had a non-conflicting git merge break a .csproj file.

Space Whale
Nov 6, 2014
Architect says hundreds of sprocs are less maintainable than EF.

I don't know if that's true, but having heard about SSDT I wonder how easy that's gotten lately. Also, we use git, not TFS - is this a problem?

I can always fiddle with SSDT on my own but I'm just an upstart build guy, not. A DBA or admin. What should I try to show with it?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Space Whale posted:

Architect says hundreds of sprocs are less maintainable than EF.

I don't know if that's true, but having heard about SSDT I wonder how easy that's gotten lately. Also, we use git, not TFS - is this a problem?

I can always fiddle with SSDT on my own but I'm just an upstart build guy, not. A DBA or admin. What should I try to show with it?

Stored procedures encourage you to cram business logic in your data access layer, which is never a good thing. I'd tend to agree with your architect, even taking SSDT into account. Have you ever renamed a column used in several dozen stored procedures? It can be a big pain in the rear end.

SSDT doesn't care what you use for source control, it just represents your database schema in a source control-friendly fashion.

wwb
Aug 17, 2004

Bognar posted:

I can't think of a time where I had a non-conflicting git merge break a .csproj file.

Me too.

I'd try using a better merge tool -- I have had some success with sourcetree. I also really like kdiff2 which comes bundled with tortoisehg.

aBagorn
Aug 26, 2004

Ithaqua posted:

Stored procedures encourage you to cram business logic in your data access layer, which is never a good thing. I'd tend to agree with your architect, even taking SSDT into account. Have you ever renamed a column used in several dozen stored procedures? It can be a big pain in the rear end.

SSDT doesn't care what you use for source control, it just represents your database schema in a source control-friendly fashion.

The client's DBA I'm working with is the opposite.

He wants everything done with stored procs, and I'm trying to convince him to let us use EF, hence my above question. He said something at our last meeting about EF caching and locking data in a load balanced environment, and that it scales horribly because of that, but prefaced that he last worked with EF 4. I can't find any definitive definitions either way about EF6.

If my application is being used by 2+ servers simultaneously to hit the same database, how is EF6 going to handle concurrency? Should I be disposing context every chance I get to avoid race conditions?

Inverness
Feb 4, 2009

Fully configurable personal assistant.
My business is also one that does 80% of things in stored procs for our main product. We also support both MSSQL and Oracle. I'd rather gouge my eyeballs out than jump into that mess.

Instead I'm navigating towards the mobile world with Xamarin for iOS and Android. Can anyone tell me how fun that is going to be?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

aBagorn posted:

If my application is being used by 2+ servers simultaneously to hit the same database, how is EF6 going to handle concurrency? Should I be disposing context every chance I get to avoid race conditions?

Disposing contexts has nothing to do with race conditions or concurrency. In fact, it's not (strictly speaking) necessary: http://blog.jongallant.com/2012/10/do-i-have-to-call-dispose-on-dbcontext.html#.U6WdzrGEeTw

Dealing with concurrent data data access/updates in EF6:
http://www.asp.net/mvc/overview/get...mvc-application

Transactions in EF6:
https://msdn.microsoft.com/en-us/data/dn456843.aspx

Essential
Aug 14, 2003
^^^^^^Listen to Ithaqua over me, I guess I'm wrong, however I'll leave what I've experienced here.


aBagorn posted:

Should I be disposing context every chance I get to avoid race conditions?

I can't speak on caching/load balancing, but yes, you should dispose context every time you use it. Always wrap it in a using statement. I gather that it's meant to be thrown away and use a new one every time.

If you don't, you'll get weird poo poo happening and it won't always manifest itself right away, making the problem that much less obvious. I also had some really, really bad performance issue's that were solved when I stopped trying to reuse a context.


VVVV Hah, well yeah that's what I meant. :)

Essential fucked around with this message at 01:14 on Feb 10, 2015

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Essential posted:

^^^^^^Listen to Ithaqua over me, I guess I'm wrong, however I'll leave what I've experienced here.


I can't speak on caching/load balancing, but yes, you should dispose context every time you use it. Always wrap it in a using statement. I gather that it's meant to be thrown away and use a new one every time.

If you don't, you'll get weird poo poo happening and it won't always manifest itself right away, making the problem that much less obvious. I also had some really, really bad performance issue's that were solved when I stopped trying to reuse a context.

Listen to the guy who wrote that blog post, not me. He actually spoke to people who work on EF. I don't know poo poo. :shrug:

aBagorn
Aug 26, 2004
Follow up, so if I'm reading these correctly, EF does NOT by default lock DB rows?

This is something that he's hung up on and the more ammo I can take in the better.

xgalaxy
Jan 27, 2004
i write code
Anyone have any good resources on how to use nRefactory? Aside from the Codeproject site?

Destroyenator
Dec 27, 2004

Don't ask me lady, I live in beer

aBagorn posted:

Follow up, so if I'm reading these correctly, EF does NOT by default lock DB rows?

This is something that he's hung up on and the more ammo I can take in the better.
I think the answer is to just write some code and use a profiler to see what gets sent to the SQL server. You can show each other the actual SQL and decide if it'll be acceptable. Usually with EF I would create a new context per request (so entity caching happens per request), and use transactions (with using blocks) where you need them.

What migration strategy will you be using, and how does the DBA feel about that?

edit: that's a context per web request, not DB request.

Dreadrush
Dec 29, 2008

aBagorn posted:

Follow up, so if I'm reading these correctly, EF does NOT by default lock DB rows?

This is something that he's hung up on and the more ammo I can take in the better.

EF will not be doing anything special when calling your database compared to any other way of talking to your database. It should be using a read committed database isolation level by default, and you can explicitly change this in cases if you want to. When performing updates, individual commands will be sent for each row updated. Row locks will occur in the same fashion as if you have manually pushed out the same commands.

Some differences in a load balanced scenario that I can think of (which are fairly minor):
- EF has a once-off slow startup time (validating its model is correct) which will occur on each server.
- When you write a query with linq, EF needs to generate the necessary parameterized sql query. This can take a relatively long time, so after it has been called, EF caches this, so that next time it will already have the generated sql and run really fast. This cost also will need to occur on each server.

RICHUNCLEPENNYBAGS
Dec 21, 2010

wwb posted:

Me too.

I'd try using a better merge tool -- I have had some success with sourcetree. I also really like kdiff2 which comes bundled with tortoisehg.

Why would that make a difference if there are no conflicts?

It just ends up assuming closing tags and so on are duplicated between versions when it isn't necessarily true.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

aBagorn posted:

Follow up, so if I'm reading these correctly, EF does NOT by default lock DB rows?

This is something that he's hung up on and the more ammo I can take in the better.

This guy sounds like he's off his rocker. There's nothing different about running EF distributed or not, and definitely not in regards to DB locking. EF makes no explicit choice to lock tables or rows (though SQL Server may choose to do so depending on the query - EF or not). If he still takes convincing, just hook up a profiler. There's nothing terribly special about the SQL that EF generates, aside from the fact that it can be horribly verbose at times.

Space Whale
Nov 6, 2014
Just so I know and I don't start looking for faeries and pixies in my computer: How the gently caress can something build on my machine, even if the reference to a dependency is broken? It clearly won't do it on my build server, which is why I care, but when I look at my machine it's... not there either.

Is it in the Global Assembly Cache? Just in the ether? wtf

Also, in general, how much of a PITA is it to finally whip a solution into building properly and using NuGet correctly?

Blasphemeral
Jul 26, 2012

Three mongrel men in exchange for a party member? I found that one in the Faustian Bargain Bin.

Space Whale posted:

... a PITA ... whip a solution ... using NuGet...

Great, now I'm hungry. :argh:

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Space Whale posted:

Just so I know and I don't start looking for faeries and pixies in my computer: How the gently caress can something build on my machine, even if the reference to a dependency is broken? It clearly won't do it on my build server, which is why I care, but when I look at my machine it's... not there either.

I'd always check the GAC first in a situation like that. Of course, I've also been traumatized by SharePoint development where deploying a solution puts all of your dependencies in the GAC which leads to a bunch of loving problems on other projects. For example, if you have a library in the GAC, then the Azure deployment process from VS may not copy that library to the deployment target - leading to a week where we would only deploy from one machine because it magically worked there and not elsewhere and we couldn't figure out why.

mst4k
Apr 18, 2003

budlitemolaram

Bognar posted:

I'd always check the GAC first in a situation like that. Of course, I've also been traumatized by SharePoint development where deploying a solution puts all of your dependencies in the GAC which leads to a bunch of loving problems on other projects. For example, if you have a library in the GAC, then the Azure deployment process from VS may not copy that library to the deployment target - leading to a week where we would only deploy from one machine because it magically worked there and not elsewhere and we couldn't figure out why.

Dealing with this now myself. I'm also looking for a new job.

wwb
Aug 17, 2004

RICHUNCLEPENNYBAGS posted:

Why would that make a difference if there are no conflicts?

It just ends up assuming closing tags and so on are duplicated between versions when it isn't necessarily true.

I'm not sure but I suspect seeing what is going on will help -- it sounds like someone is doing something retarded like switching line endings which is blowing things up. Have you looked at a diff before you merged?

chippy
Aug 16, 2006

OK I DON'T GET IT
For what it's worth, I've seen non-conflicting merges produce invalid XML in project files as well.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Space Whale posted:

Also, in general, how much of a PITA is it to finally whip a solution into building properly and using NuGet correctly?

It's very easy. NuGet.org has docs that explain everything in excruciating detail.

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug

Space Whale posted:

Also, in general, how much of a PITA is it to finally whip a solution into building properly and using NuGet correctly?

Not that bad. If you have Resharper if you right click on the reference and pick Project Hierarchy it will show you all of the projects referencing the assembly. You can then right click on the solution, manage Nuget packages for solution, and add the package to your projects. I recheck the references to make sure they are correct because I've had Nuget not do the right thing. If your build system doesn't restore nuget packages automatically you'll have to check nuget.org for instructions. For internal assemblies you can run your own nuget server if needed.

I'm literally in the process of doing this at work for some of our external dependencies. Someone added a new project with log4net through Nuget, but other projects had references to the assembly in a lib folder. Everything compiled but programs crashed, very annoying.

hirvox
Sep 8, 2009

RICHUNCLEPENNYBAGS posted:

Big git merges invariably break csproj files and it sucks. Do you guys have any strategies to deal with that?
Like others have said, merge early, merge often. Or preferably rebase. When you're working on your separate branch, periodically pull changes to the main development branch and then either merge them to your working branch or rebase your working branch off the latest version of the main development branch. If you keep doing it, the final merge back will be pretty painless.

Also, the default in-place merging puts all changes into the same file. While it allows you to use any text editor for the cleanup, IMHO it's easy to forget to delete duplicate lines or leave invalid XML in. I prefer to use Visual Studio's own three-way merge, where the two source files are kept separate from the merged file.

You can tell Git to use Visual Studio for diffs and merges by adding the following lines to your .gitconfig:
code:
[diff]
    tool = vsdiffmerge
[difftool]
      prompt = false
[difftool "vsdiffmerge"]
      cmd = '"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe"' "$LOCAL" "$REMOTE" //t
      keepbackup = false
      trustexistcode = true
[merge]
      tool = vsdiffmerge
[mergetool]
      prompt = false
[mergetool "vsdiffmerge"]
      cmd = '"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe"' "$REMOTE" "$LOCAL" "$BASE" "$MERGED" //m
      keepbackup = false
      trustexistcode = true

Adbot
ADBOT LOVES YOU

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
Huh, I've never used Visual Studio's diff merge, I always just installed Tortoise Git to use their graphical merge tool which is pretty decent. Anyone have a comparison between the two?

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