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
RICHUNCLEPENNYBAGS
Dec 21, 2010

fleshweasel posted:

Are there any trip reports out there of people's experience working on ASP.NET projects with Visual Studio Code?

Is there any reason to prefer doing this?

Adbot
ADBOT LOVES YOU

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

RICHUNCLEPENNYBAGS posted:

Is there any reason to prefer doing this?

Not having a PC?

wwb
Aug 17, 2004

Or preferring linux.

Sitepoint just did an article on it which might be a good starting point.

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

fleshweasel posted:

Are there any trip reports out there of people's experience working on ASP.NET projects with Visual Studio Code?

Better than Omnisharp on its own, but Visual Studio is still the best solution if you need to make a full blown ASP.NET site. It will get better over time though as VNext matures though. And I like it more than Sublime Text.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

fleshweasel posted:

Are there any trip reports out there of people's experience working on ASP.NET projects with Visual Studio Code?

I played around with it on my Mac a few weeks ago. It's good. There's no debugging for .NET on non-Windows OSes yet, but overall it's very intuitive and not surprisingly fits in well with the new structure of ASP .NET 5 projects. I haven't done anything big with it yet, but I was taking a stab at porting an older MVC application over (unsuccessfully, I might add).

It was awesome for node, though.

Calidus
Oct 31, 2011

Stand back I'm going to try science!

fleshweasel posted:

Are there any trip reports out there of people's experience working on ASP.NET projects with Visual Studio Code?

It use it to edit config files, I fire up VS for just about everything else.

aBagorn
Aug 26, 2004

Ithaqua posted:

It was awesome for node, though.

:agreed:

It's really great with Node. I found it more intuitive than the Node Tools for Visual Studio add on, though I only used that once

brap
Aug 23, 2004

Grimey Drawer
I use a Mac at home and PCs at work. I think I'm still inclined to spin up my Windows virtual machine with Visual Studio for .NET work.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

fleshweasel posted:

I use a Mac at home and PCs at work. I think I'm still inclined to spin up my Windows virtual machine with Visual Studio for .NET work.

I will use a Windows machine/VM for .NET development until ReSharper is available on Visual Studio Code (even if that never happens).

ljw1004
Jan 18, 2005

rum

Bognar posted:

I will use a Windows machine/VM for .NET development until ReSharper is available on Visual Studio Code (even if that never happens).

I'm curious if there are any particular features of ReSharper that you have in mind? Or is it just the whole package? (I'm in the VB/C# team, and we're certainly delighted that folks use ReSharper, but we'd like to make it so that VS isn't considered sub-par without it...)

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

ljw1004 posted:

I'm curious if there are any particular features of ReSharper that you have in mind? Or is it just the whole package? (I'm in the VB/C# team, and we're certainly delighted that folks use ReSharper, but we'd like to make it so that VS isn't considered sub-par without it...)

I think you'll see a lot of people switch off of ReSharper onto native Roslyn quickfixes once VS2015 is out. JetBrains opting to not use the Roslyn engine for the next generation of ReSharper and instead hand-roll their own static analysis engine seems like a really bad long-term decision. I love ReSharper, but it's a memory hog and can absolutely decimate performance on large projects. R#9 might be better, but I never bothered to upgrade off of 8 because I'm waiting to see what happens when VS2015 launches.

As far as I've seen, there's nothing ReSharper does that you can't do with a combination of Roslyn and StyleCop/code analysis rules. I know there's a huge Github repo with Roslyn quickfixes/warnings/inspections/whatever that more or less reimplement everything ReSharper does. I lost the URL -- maybe you know what it is!

[edit]
Huh, R# is free for MVPs. I guess I will upgrade to 9.

New Yorp New Yorp fucked around with this message at 03:25 on Jun 15, 2015

RICHUNCLEPENNYBAGS
Dec 21, 2010
9 is a big improvement over 8 IMO.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

ljw1004 posted:

I'm curious if there are any particular features of ReSharper that you have in mind? Or is it just the whole package? (I'm in the VB/C# team, and we're certainly delighted that folks use ReSharper, but we'd like to make it so that VS isn't considered sub-par without it...)

I'll start compiling a list of all the things that I use in R# (it's a lot), but off the top of my head:

Navigation options
Go To File, Go To Class, Go To Symbol. R# has all, but to my knowledge VS only has the latter (Ctrl + , - and it's slow)
Go To Base/Derived Symbol. These can be super useful for quickly navigating complex inheritance hierarchies, or when looking for implementations of an interface.
Find Usages. I think this is covered fairly well by VS's Find All References, but I mostly just use R# for this so I can't say which is better.

Search
Structural Search (and Replace). This is awesome - you can write an expression to search for, specifying which parts of the expression are of a certain type, which parts inherit from a certain type, which parts are just plain text, etc. Then you can use those designations to perform a replace if necessary. It's a language aware searching tool, and I don't know of a corollary in VS.

General
Built-in decompiler. This helps debug third-party libraries (we've submitted numerous bug reports to third-party vendors including a class + method location).
Snippets. Like the search above, this is more advanced than VS's code snippets.
foreach loop -> LINQ rewriting. This can produce some monstrosities, but it can also simplify some unnecessarily lengthy and confusing code.
JavaScript linting. VS doesn't do this (or didn't last I checked).
Regular Expression assistance. Syntax highlighting + an Intellisense-style window that pops up with suggestions while writing a regex

I'm intentionally leaving out all the C# linting, since Roslyn is coming out with promises of doing that for us. However, for me the navigation options are huge - I know all the hotkeys so I can zip around a codebase super fast without ever touching the mouse (aided by VsVim). If VS had good replacements for advanced navigation, I would consider leaving R# behind.

Cryolite
Oct 2, 2006
sodium aluminum fluoride
I second the navigation. Ctrl+T is worth the cost of ReSharper alone.

Destroyenator
Dec 27, 2004

Don't ask me lady, I live in beer
I didn't realise how far the Roslyn stuff has come but yeah the three types of search and go to implementations for interfaces, refactor tools (especially introduce var/param and inline), snippet stuff for all the common operations (use var, invert if to reduce nesting, remove dead code, simplify conditionals, foreach-linq conversions, remove braces).

I find in a solution with DI/IoC I'm using this pattern all the time: type "_userService", alt-enter -> introduce field, the type is highlighted so type "IUS" press enter, alt-enter -> initialise from ctor param (which jumps to the ctor), jump up to issue and alt-enter -> make readonly, jump down issue which is usually my unfinished line. It looks like with the Roslyn stuff I'd be able to make that a thing I can do in one step?

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

Cryolite posted:

I second the navigation. Ctrl+T is worth the cost of ReSharper alone.

Resharper remaps ctrl+T? How are its users supposed to swap the characters on either side of the cursor!?

(This is the most baffling hot-key default in the universe. Such a sweet peach of a key combo with such a useless function. Can anyone here explain a case where it's useful? I get really (irrationally) upset about this. Please help.)

zokie
Feb 13, 2006

Out of many, Sweden

Cryolite posted:

I second the navigation. Ctrl+T is worth the cost of ReSharper alone.

Edit > Navigate to...

Is basically the same, but unbound by default. There is also a "Sync with active document" button on top of the solution explorer that works like Shift+Alt+L.

In VS2015 I'm holding off installing R#, I miss "Go to Implementation" and the testrunner the most. The NUnit stuff for the VS testrunner doesn't work very well :(
Getting usings when copy-pasting is also nice.


Otherwise I've found that VS has a lot of R# "features" natively.

Sedro
Dec 31, 2008

Newf posted:

Resharper remaps ctrl+T? How are its users supposed to swap the characters on either side of the cursor!?

(This is the most baffling hot-key default in the universe. Such a sweet peach of a key combo with such a useless function. Can anyone here explain a case where it's useful? I get really (irrationally) upset about this. Please help.)
Meanwhile you can comment code with Ctrl+K + Ctrl+C, Ctrl+K + Ctrl+U and auto-import with Ctrl+Alt+F10 !

The best thing about R# is switching to IntelliJ shortcuts.

Blasphemeral
Jul 26, 2012

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

Sedro posted:

Meanwhile you can comment code with Ctrl+K + Ctrl+C, Ctrl+K + Ctrl+U and auto-import with Ctrl+Alt+F10 !

The best thing about R# is switching to IntelliJ shortcuts.

These multi-step keyboard "shortcuts" are the major thing I've always been dumbfounded with ever since I started developing professionally. What was someone high-on when they came up with some of these? Do they really think it helps? The very first thing I ever do with a new install of VS is rebind block-comment and uncomment to the Notepad++ default of Ctrl+Q and Ctrl+Shift+Q, respectively, rather than the two-or-three-step mess they are by default. It is literally the most-used shortcut I have after cut/copy/paste.

The things you do the most often should have the easiest shortcuts. Ctrl+Q & Ctrl-Shift-Q, by default, are some weird processes I would never think of using in my most fevered dreams. Comment, though? Two or three steps.

Blasphemeral fucked around with this message at 18:19 on Jun 15, 2015

TheCosmicMuffet
Jun 21, 2009

by Shine

Newf posted:

Resharper remaps ctrl+T? How are its users supposed to swap the characters on either side of the cursor!?

In my vs 2015, I can't get it to remap Ctrl+T... it keeps reverting to swap characters.

Whoever put it in is serious about that feature.

Sab669
Sep 24, 2009

I have what I feel like is a dumb question, but me and my coworkers are all stumped as to what the gently caress is going on here.

I have an ASP page with 3 DataGrids on it.

The user enters some search parameters, clicks Search and it populates one Grid. The user single-selects a row (It has an ASP:radiobutton template column that gets databound to a unique ID) which postsback and populates the remaining two grids.

The remaining grids also have template columns, but with HTML checkbox input controls, which are also DataBound to a unique ID.

Based on their selection of data from these three grids, the application is supposed to display a value from one of the columns in a label on the page.

The problem I'm having is that the application saves the grids' data sources to an XML file / loads them back into the grid between postbacks, but the Checked state of the radio button / checkbox isn't being saved correctly- the field is always written as a 0 to the XML file for some reason. Even if I change it to a 1, when it gets loaded it still doesn't appear checked.

I think it has something to do with how the template columns are bound but I am so inexperienced with web dev I'm not fully sure what's going on. Anyone know if that's an actual problem / concern? Can't get to SA on my work computer so I can't really post code.

At this point I'm considering just rewriting this entire drat page, I have no idea who wrote it but it was so sloppy-- and that's coming from me, here. But even still I don't really know what's the best way to approach this to try and fix it.

Edit; should mention I tried using ASP: checkboxes but again I was having so many issues with how this page loads data that for some reason the checkboxes were behaving like radio buttons, or the UI simply wasn't reflecting their checked state at all.

Sab669 fucked around with this message at 20:10 on Jun 15, 2015

Iverron
May 13, 2012

I turn R# on and off as needed simply because it absolutely loving mangles my cshtml files, has some weird issue with VsVim commands at times and tends to be a little sluggish in larger projects.

Mellow_
Sep 13, 2010

:frog:

ljw1004 posted:

I'm curious if there are any particular features of ReSharper that you have in mind? Or is it just the whole package? (I'm in the VB/C# team, and we're certainly delighted that folks use ReSharper, but we'd like to make it so that VS isn't considered sub-par without it...)

My favourite portion of ReSharper are the recommendations. I worked in C# prior to LINQ and the ReSharper method to LINQ help basically taught me LINQ in its entirety.

Mr Shiny Pants
Nov 12, 2012
So if I want to run commands on a Linux machine, and I don't have an API the only way is to use Process.Start, redirect the output and scrape it?

It is what I've been doing now and boy filtering console output is a pain in the rear end.

biznatchio
Mar 31, 2001


Buglord

Mr Shiny Pants posted:

It is what I've been doing now and boy filtering console output is a pain in the rear end.

But that's The Unix Way™! Everything's a stream of bytes intended for human consumption and if you like parsing boy howdy have I got good news for you!

Seriously though, depending on what you're trying to scrape and how you're trying to scrape it, you might benefit from building and using some standardized translators to process the input lines in easily definable ways and compose them together to achieve what you want in each case; or Process.Start to /bin/sh and pipe through standard unix text-processing utilities which are basically the same thing. A shell like Powershell makes a lot more sense for moving structured data between tasks, but for as inefficient as processing human-readable stdout is in Unix, at least they've built up a really good suite of utilities that make the concept workable.

Mr Shiny Pants
Nov 12, 2012

biznatchio posted:

But that's The Unix Way™! Everything's a stream of bytes intended for human consumption and if you like parsing boy howdy have I got good news for you!

Seriously though, depending on what you're trying to scrape and how you're trying to scrape it, you might benefit from building and using some standardized translators to process the input lines in easily definable ways and compose them together to achieve what you want in each case; or Process.Start to /bin/sh and pipe through standard unix text-processing utilities which are basically the same thing. A shell like Powershell makes a lot more sense for moving structured data between tasks, but for as inefficient as processing human-readable stdout is in Unix, at least they've built up a really good suite of utilities that make the concept workable.

Yeah that is what I thought :)

I am trying to build a webservice for my Nas, so I can check the status of my Zpools, create a new one and such.....

Getting empty disks, checking if they are not already in a pool and creating a new one is quite the adventure.

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

Sedro posted:

Meanwhile you can comment code with Ctrl+K + Ctrl+C, Ctrl+K + Ctrl+U and auto-import with Ctrl+Alt+F10 !

The best thing about R# is switching to IntelliJ shortcuts.

I don't mind multi-key shortcuts if the organization follows some sort of logic. Eg, in some version of VS most of the debug windows can be triggered via ctrl-d, ctrl+something. This is sensible and good - the commands follow a tree structure, and the tree nodes are namable; ctrl-d is named 'Debug Windows', and from there ctrl-L is named 'Local Variables'.

What sucks is when the first step key combo reveals a bunch of completely unrelated functions - it makes it way harder to internalize the semantics of the commands.

Essential
Aug 14, 2003
Anybody have any experience setting up a https endpoint for an Azure cloud service? I followed this guide: https://support.microsoft.com/en-us/kb/2990804

I've setup the CNAME record on my public site, the certificate is loaded into Azure for that cloud service and I can browse to the https cloud service directly (although I get a certificate error warning the certificate was issued to another domain). However, I'm not sure how to force the CNAME redirect to the https endpoint. I think I may just need a redirect rule in the web.config or csdef file, but I can't find anything on how to set that up.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
I'm not entirely sure what you're asking, but I think there may be a misunderstanding? The CNAME doesn't actually redirect HTTP requests, it just redirects the DNS request. If you have another server somewhere that needs to redirect to Azure, then you'll need to set that up separately. I've set up TLS on all of our Azure sites, but I need a bit more information about what you're doing to help.

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick
Something I've wondered for a while now, and don't recall seeing a reasonable answer: If you can define an enum with a specific underlying type, why can't the enum implicitly convert to that type without having to be cast first? Surely since an enum is a subset of whatever underlying type it's been created with, it should be totally legit to do something like:
code:
enum Blah : byte 
{
  B1 = 0x01,
  B2 = 0x02,
  B3 = 0x03
}
void DoSomething(byte b) { }

DoSomething(Blah.B1);
instead of having to cast
code:
DoSomething((byte)Blah.B1);
I'm fine with having to cast the other way around, e.g.
code:
void DoSomethingElse(Blah b);

DoSomething(0x02);


since passing runtime values into DoSomethingElse won't necessarily map to a Blah, so you'd want to be explicit that that's the behaviour you wanted. But given the definition above, a Blah is always going to be a byte, so why can't you just pass a Blah into a byte parameter without the cast?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

beuges posted:

Something I've wondered for a while now, and don't recall seeing a reasonable answer: If you can define an enum with a specific underlying type, why can't the enum implicitly convert to that type without having to be cast first? Surely since an enum is a subset of whatever underlying type it's been created with, it should be totally legit to do something like:
code:
enum Blah : byte 
{
  B1 = 0x01,
  B2 = 0x02,
  B3 = 0x03
}
void DoSomething(byte b) { }

DoSomething(Blah.B1);
instead of having to cast
code:
DoSomething((byte)Blah.B1);
I'm fine with having to cast the other way around, e.g.
code:
void DoSomethingElse(Blah b);

DoSomething(0x02);


since passing runtime values into DoSomethingElse won't necessarily map to a Blah, so you'd want to be explicit that that's the behaviour you wanted. But given the definition above, a Blah is always going to be a byte, so why can't you just pass a Blah into a byte parameter without the cast?

My understanding from Jon Skeet and folks on the C# team is that "enums are weird"

I think he talks about enum weirdness in this: http://oredev.org/2010/sessions/c-s-greatest-mistakes

But I could be misremembering.

Essential
Aug 14, 2003

Bognar posted:

I'm not entirely sure what you're asking, but I think there may be a misunderstanding? The CNAME doesn't actually redirect HTTP requests, it just redirects the DNS request. If you have another server somewhere that needs to redirect to Azure, then you'll need to set that up separately. I've set up TLS on all of our Azure sites, but I need a bit more information about what you're doing to help.

Thanks Bognar.

Sorry for the confusion, I believe I'm mixing up terms here. My end goal here is to access my WCF azure cloud service over https, from my visual studio projects. I'd like to setup a Service Reference from visual studio over https.

I have a CNAME record on my public site which redirects the DNS request to my Azure cloud service, site.cloudapp.net (WCF cloud service). I wasn't sure how to get that DNS request to access my https cloud service (https://site.cloudapp.net/service.svc). I've since got that solved by adding this to the web.config of my wcf azure cloud service project (this comes from Steve Marx's blog):

code:
    <rewrite>
      <rules>
        <rule name="Redirect to HTTPS">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="SeeOther" />
        </rule>
      </rules>
    </rewrite>
That seems to have solved the issue of the DNS request going to my https cloud service url.

However, I'm unable to add a service reference from visual studio to my https endpoint. I just got off the phone with Azure support and they are escalating it to a wcf expert. The support rep narrowed it down to what he believes is a problem with the httpBinding and/or with the metadata file pointing to http, rather than https. The metadata is available over http, just not https. In the metadata for http I can see an http url and the https svc page is trying (I think) to link back to the http metadata file and it can't.

I think I need to setup an https Binding either in both my wcf project and/or my client app. It looks like I need an https metadata file.

EDIT: All I needed to do was expose the metadata over https: httpsGetEnabled="true". That seems to have worked!

Essential fucked around with this message at 18:05 on Jun 17, 2015

EssOEss
Oct 23, 2006
128-bit approved

ljw1004 posted:

I'm curious if there are any particular features of ReSharper that you have in mind? Or is it just the whole package? (I'm in the VB/C# team, and we're certainly delighted that folks use ReSharper, but we'd like to make it so that VS isn't considered sub-par without it...)

For me, it is two things.

First, Alt+Enter. Pressing this key combination tends to make everything alright without having to think about it. The VS quick fixes, though often on the money for the actual fixing, are far less approachable - I have to actually be on the right line, with the cursor in the right place, and I have to press Control+Dot which is not a comfortable key combination and then I have to find in the dropdown menu what the right thing is and press enter again. Very tedious compared to R#! For example, after copy-pasting some code, spamming Alt+Enter just wires everything up which is awesome and not something VS does on its own.

The other is a more in-depth code formatting feature, especially when combined with shared settings so that each team member has the exact same code formatting. Press Control+E+D and the document becomes formatted according to the standardized team style. It also has way more formatting options - VS just does tab or space, whereas R# - well, there are pages and pages of code formatting settings.

Conversely, one thing I absolutely do not care for but which seems to get a lot of attention is refactoring - I know how code works. Beyond a basic rename refactoring, I need none of them. Though come to think of it, I do recall the rename refactoring in VS not renaming filenames when the filename matches the class name. That was really annoying - I was trying "VS 2015 without R#" recently and this made me install ReSharper.

Edit: Control+T is also awesome.

EssOEss fucked around with this message at 10:29 on Jun 18, 2015

uXs
May 3, 2005

Mark it zero!
Doing some vNext stuff and running into the following:

In earlier version of .NET, different configurations for different environments could be handled by config transforms.

In vNext, those are gone, and you're supposed to use environment variables (ASPNET_ENV for example) to check for the environment and load the correct config file. But what are you supposed to do if you require multiple configurations on the same server?

We have a test IIS server where we put (at least) 2 test copies of our website: one for internal testing and one for user testing. At the very least those use different databases and thus database connections. I can't use the environment variables to differentiate between configs because those are server-wide.

Any ideas? I could manually gently caress around with the deployment and just delete the config files that it shouldn't use, but that's stupid.

Space Whale
Nov 6, 2014
Crossposting from the SQL thread since nobody there knows MSSQL.

How do I ensure ACID transactions? Are there keywords in a stored procedure? I've only ever done CRUD type poo poo as part of being a web dev or basic scripting of poo poo, and some baby schema generation, nothing like this before. I'd rather not gently caress it up.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Space Whale posted:

Crossposting from the SQL thread since nobody there knows MSSQL.

How do I ensure ACID transactions? Are there keywords in a stored procedure? I've only ever done CRUD type poo poo as part of being a web dev or basic scripting of poo poo, and some baby schema generation, nothing like this before. I'd rather not gently caress it up.

Use transactions.

RangerAce
Feb 25, 2014

uXs posted:

Doing some vNext stuff and running into the following:

In earlier version of .NET, different configurations for different environments could be handled by config transforms.

In vNext, those are gone, and you're supposed to use environment variables (ASPNET_ENV for example) to check for the environment and load the correct config file. But what are you supposed to do if you require multiple configurations on the same server?

We have a test IIS server where we put (at least) 2 test copies of our website: one for internal testing and one for user testing. At the very least those use different databases and thus database connections. I can't use the environment variables to differentiate between configs because those are server-wide.

Any ideas? I could manually gently caress around with the deployment and just delete the config files that it shouldn't use, but that's stupid.

Environment variables are not really server-wide. In IIS, you can set environment variables at just about any level of configuration using the <environmentvariables> config element. You should be able to set a variable for each site, and then use that thusly: http://stackoverflow.com/a/26478436/221648

uXs
May 3, 2005

Mark it zero!

RangerAce posted:

Environment variables are not really server-wide. In IIS, you can set environment variables at just about any level of configuration using the <environmentvariables> config element. You should be able to set a variable for each site, and then use that thusly: http://stackoverflow.com/a/26478436/221648

That's a fastCgi thing and isn't read by asp.net.

RangerAce
Feb 25, 2014

uXs posted:

That's a fastCgi thing and isn't read by asp.net.

Well, that sucks.

Adbot
ADBOT LOVES YOU

RangerAce
Feb 25, 2014

What about setting up different users for each site and have the different sites use different app pools that run as different users? Then, you should be able to set ASPNET_ENV differently for each user.

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