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
Gul Banana
Nov 28, 2003

another day, another reason to avoid UWP...

Adbot
ADBOT LOVES YOU

Mr Shiny Pants
Nov 12, 2012
The whole WinRT stuff is just........

A shame really because WPF is pretty good but could have used some more attention from MS.

chippy
Aug 16, 2006

OK I DON'T GET IT

spiderlemur posted:

Why does debugging any MVC application take 8 - 9 seconds on a reasonably fast machine (SSD, modern i7, plenty of memory)? I tried Core to see if things improved but I can't get at a point where pressing "start debugging" (or even starting without debugging) gives me a page faster than 7 seconds or so.

It makes things kind of annoying to debug when you're changing anything in the C# end and want to run again. Is there a way to speed this process up?

I'm currently working on a customised version of an open source e-commerce system (nopCommerce). They've mananaged to somehow the structure the project in such a way that unless you do a clean/rebuild every time you make changes to one of the subprojects, it ends up running with the old versions of the DLLs. The build takes 20 seconds and the startup time for the project is 30 seconds. So I'm looking at 50 seconds to your 7 every time I want to test a one-line bug fix.

Sorry this isn't helpful but hopefully it shows you that things could be worse. :D

smarion2
Apr 22, 2010
I could be wrong as I don't work much with ASP but maybe try to keep IIS express running after you close the debugger? If I where to guess having to start IIS express everytime would cause a bit of dely.

http://stackoverflow.com/questions/19568762/how-can-i-prevent-visual-studio-2013-from-closing-my-iis-express-app-when-i-end

Nth Doctor
Sep 7, 2010

Darkrai used Dream Eater!
It's super effective!


This may be an appropriate question for the infosec thread, but since it's .NET specific, I'm dropping it here:
I need to encrypt some data with AES 128 or higher. Looking at the System.Security.Cryptography namespace, I see 3 implementations of the abstract AES class. Does anyone have any experience with any of these implementations, or suggestions on which one may be the safest to use?

EssOEss
Oct 23, 2006
128-bit approved
I would just use Aes.Create() and let the platform pick the most appropriate one, unless you have some special requirements.

As for what they are, AesManaged is a fully-managed-code (C#) implementation of AES. AesCryptoServiceProvider uses the older CSP API from Windows, AesCng uses the newer CNG API. The latter two might be relevant if you care about things like FIPS compatibility or hardware acceleration. They all work fine, though.

Zero The Hero
Jan 7, 2009

Mr Shiny Pants posted:

The whole WinRT stuff is just........

A shame really because WPF is pretty good but could have used some more attention from MS.

I've been trying to learn UWP for a few weeks in my spare time, I wish I knew it was actually going to be worth it. I hope it doesn't go the way of Silverlight. Maybe I should stick with WPF....

Nth Doctor
Sep 7, 2010

Darkrai used Dream Eater!
It's super effective!


EssOEss posted:

I would just use Aes.Create() and let the platform pick the most appropriate one, unless you have some special requirements.

As for what they are, AesManaged is a fully-managed-code (C#) implementation of AES. AesCryptoServiceProvider uses the older CSP API from Windows, AesCng uses the newer CNG API. The latter two might be relevant if you care about things like FIPS compatibility or hardware acceleration. They all work fine, though.

Oh, good call. Didn't notice that.

Baloogan
Dec 5, 2004
Fun Shoe
microsoft needs to loving figure out their UI poo poo because im like vaguely panicking about winforms being shot in the fuckin head

xgalaxy
Jan 27, 2004
i write code
Hate to say it but the OS X / iOS UI developer story is miles ahead of anything Microsoft has right now.

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings

Baloogan posted:

microsoft needs to loving figure out their UI poo poo because im like vaguely panicking about winforms being shot in the fuckin head

Is this even a remote possibility? I thought WinForms was already largely just an abandoned technology(from the MS perspective) but due to how they support everything forever, it'll be another decade before WinForms apps are just plain broken?

Plus, it isn't like UWP is *too* far gone, is it? I mean, isn't it just a weird next step in the evolution of Win8 tech? So even if it gets retired, it'll just be in favor of some NEW XAML-based framework with a slightly different C# library?

Plus I mean, they seem to care about it - Anniversary Update finally gives a native Boolean-to-Visibility converter - nearly a decade late but, you know, better late than never :v:

Zero The Hero
Jan 7, 2009

Cuntpunch posted:

Is this even a remote possibility? I thought WinForms was already largely just an abandoned technology(from the MS perspective) but due to how they support everything forever, it'll be another decade before WinForms apps are just plain broken?

Plus, it isn't like UWP is *too* far gone, is it? I mean, isn't it just a weird next step in the evolution of Win8 tech? So even if it gets retired, it'll just be in favor of some NEW XAML-based framework with a slightly different C# library?

Plus I mean, they seem to care about it - Anniversary Update finally gives a native Boolean-to-Visibility converter - nearly a decade late but, you know, better late than never :v:

WPF was the official replacement for WinForms, so they've been legacy for about 8 years now. I don't know that UWP is going anywhere any time soon, MS appears to be pushing it as the next successor. But they did this to Silverlight too, so who knows what will happen? I imagine both WPF and UWP will be properly maintained for at least the next several years.

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings

Zero The Hero posted:

WPF was the official replacement for WinForms, so they've been legacy for about 8 years now. I don't know that UWP is going anywhere any time soon, MS appears to be pushing it as the next successor. But they did this to Silverlight too, so who knows what will happen? I imagine both WPF and UWP will be properly maintained for at least the next several years.

Eh, Silverlight was a late-to-the-party attempt to fight Flash. If it had shown up 5 years earlier it probably would have had some sticking power - but instead it was just too late to matter - Flash itself was already showing its age and being replaced by HTML5, etc, and then suddenly a "oh boy another plugin for rich web content!" shows up. Just old-school Microsoft lovely timing.

mystes
May 31, 2006

Cuntpunch posted:

Eh, Silverlight was a late-to-the-party attempt to fight Flash. If it had shown up 5 years earlier it probably would have had some sticking power - but instead it was just too late to matter - Flash itself was already showing its age and being replaced by HTML5, etc, and then suddenly a "oh boy another plugin for rich web content!" shows up. Just old-school Microsoft lovely timing.
It was a total failure as a flash killer, but it mattered to the companies that were using it internally.

mystes fucked around with this message at 02:35 on Sep 14, 2016

Mr Shiny Pants
Nov 12, 2012

Zero The Hero posted:

I've been trying to learn UWP for a few weeks in my spare time, I wish I knew it was actually going to be worth it. I hope it doesn't go the way of Silverlight. Maybe I should stick with WPF....

To be honest I have no clue. I've created a nice application for Windows 8 using WinRT and it is working pretty well actually, the problem is that on Windows 10 the whole charms bar and stuff that actually makes it really nice to use on a tablet doesn't work anymore or is stupidly converted. Instead of the Slide in options menu you have a "Hamburger" menu on the application, it looks really really terrible.

I tried to built it in WPF at first but the touch stuff and camera stuff is non existent or broken. WPF does have the best Xaml though, DataTemplate selector on DataType? Yes please.....

So Xamarin forms............

Some consistency would have been awesome....

Zero The Hero
Jan 7, 2009

Mr Shiny Pants posted:

To be honest I have no clue. I've created a nice application for Windows 8 using WinRT and it is working pretty well actually, the problem is that on Windows 10 the whole charms bar and stuff that actually makes it really nice to use on a tablet doesn't work anymore or is stupidly converted. Instead of the Slide in options menu you have a "Hamburger" menu on the application, it looks really really terrible.

I tried to built it in WPF at first but the touch stuff and camera stuff is non existent or broken. WPF does have the best Xaml though, DataTemplate selector on DataType? Yes please.....

So Xamarin forms............

Some consistency would have been awesome....

Maybe it was a mistake to assume UWP would be Universal. Idk.

Mr Shiny Pants
Nov 12, 2012

Zero The Hero posted:

Maybe it was a mistake to assume UWP would be Universal. Idk.

Nah the UWP stuff is fine, it is the applications written specifically for Windows 8 that are stuck with broken UX.

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
What's the best practice for setting the DbConfiguration for EF6 when you have multiple referenced projects that each connect to different data sources and defined their own DbConfiguration? What I'm seeing is that the DbConfiguration gets set for the entire app domain and one or the other data library blows up because it can't find that DbConfiguration implementation in its own assembly.

So far, the bulk of google/SO results have you effectively hard-coding the DbConfiguration in the app's config file. Then, I have to go across all of these dependency projects and remove the DbConfigurationType attributes from their DbContext classes.

Maybe the correct way to do this is that DbConfiguration extensions shouldn't be happening at the same layer as setting up the DbContext?

Zero The Hero
Jan 7, 2009

Mr Shiny Pants posted:

Nah the UWP stuff is fine, it is the applications written specifically for Windows 8 that are stuck with broken UX.

I see. I guess I misunderstood

chippy
Aug 16, 2006

OK I DON'T GET IT

chippy posted:

I'm currently working on a customised version of an open source e-commerce system (nopCommerce). They've mananaged to somehow the structure the project in such a way that unless you do a clean/rebuild every time you make changes to one of the subprojects, it ends up running with the old versions of the DLLs. The build takes 20 seconds and the startup time for the project is 30 seconds. So I'm looking at 50 seconds to your 7 every time I want to test a one-line bug fix.

Sorry this isn't helpful but hopefully it shows you that things could be worse. :D

Actually, I've got a question about this if anyone can help - since moving this project to Visual Studio 2015, I get C#6 everywhere but my views. In my controllers, service layer, etc, I can use what I want, but if I try to use it in my views I get messages like 'Feature 'interpolated strings' is not available in C# 5. Please use language version 6 or greater.'.

Clearly it's some sort of project configuration issue. Does anyone know what setting I might need to change?

Gul Banana
Nov 28, 2003

do this:

chippy
Aug 16, 2006

OK I DON'T GET IT

Hmmm. Thanks for the tip, unfortunately all it got me was this in my output window:

code:
Join-Path : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ChildPath'. Specified 
method is not supported.
At C:\Projects\TC3\OnlineStore\Source\OnlineStore\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\too
ls\init.ps1:13 char:57
+ $compilerPackageDirectory = Join-Path $packageDirectory $compilerPackage.Name
+                                                         ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Join-Path], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.JoinPathCommand
 
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Projects\TC3\OnlineStore\Source\OnlineStore\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\too
ls\init.ps1:14 char:44
+ $compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools'
+                                            ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCom 
   mand
 

Anyone?

edit: And I no longer have the option in my Project menu either. Bravo, Microsoft!

chippy fucked around with this message at 11:28 on Sep 15, 2016

Gul Banana
Nov 28, 2003

o_o
well, all that menu item does really is install the nuget package. if it's already installed, the menuitem will go away.. but it looks like in your case it failed to run the install script. i have no idea why.

you could instead try following the manual instructions at https://blogs.msdn.microsoft.com/webdev/2014/05/12/enabling-the-net-compiler-platform-roslyn-in-asp-net-applications/

raminasi
Jan 25, 2005

a last drink with no ice

Ithaqua posted:

Specify an explicit package path in nuget.config.

I think this won't work because for this solution I need the "main" projects to put their packages in the usual place but I need the submodule project to put its packages in a different place, and apparently you can't set that per-project.

ljw1004 posted:

I think the most sane way is to switch over to project.json to list your NuGet dependencies (rather than project.config that you're using now).

You can use project.json to express NuGet dependencies for any project type. https://blogs.msdn.microsoft.com/lucian/2015/08/19/using-project-json-for-other-project-types/

Modern profiles (like UWP and .NETCore) solely use project.json for their NuGet dependencies.


In the future, the ability to specify NuGet dependencies in a sane way will get added to .csproj. At that time you'll have a choice between project.json and csproj for listing your NuGet dependencies. Both approaches will be sane and supported. So you're not losing anything by switching to project.json now.

Note that some packages don't work in the new sane manner... (1) the "new sane way" won't execute install scripts that are part of nuget packages, since they're inherently insane. (2) some nuget packages might need to shuffle files into different directories because of a break in NuGet.

And I can't get this to work because one of my dependencies (System.Data.SQLite) has a native part and I guess isn't constructed right to work with project.json?

Gul Banana
Nov 28, 2003

there's a Microsoft.Data.Sqlite which works I think

raminasi
Jan 25, 2005

a last drink with no ice
Hmm, I'd like to avoid totally switching a dependency just for this, if possible. But I think I got it working on my own: I migrated to Automatic Package Restore, and then changed the hint paths for the NuGet package dependencies in my .csproj files from "../packages/whatever" to "$(SolutionDir)packages/whatever".

Inverness
Feb 4, 2009

Fully configurable personal assistant.

raminasi posted:

Hmm, I'd like to avoid totally switching a dependency just for this, if possible. But I think I got it working on my own: I migrated to Automatic Package Restore, and then changed the hint paths for the NuGet package dependencies in my .csproj files from "../packages/whatever" to "$(SolutionDir)packages/whatever".
Yes, this is a significant problem for us at work since we use subrepos heavily for dependencies across repositories.

When it comes to NuGet I'm always needing to fix package paths to use $(SolutionDir)packages instead of relative paths so things will actually work when compiling projects in subrepos.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
Anyone have strong opinions on Azure app service for MVC projects?

EssOEss
Oct 23, 2006
128-bit approved
After how many months now of App Service existing, Microsoft still fails the basic step of actually stopping the web app when you deploy a new version. "Deployment failed: file MyBusinessLogic.dll is in use by another process!" is not funny when "Stop the web site before you deploy a new version" is basically ASP.NET deployment 101 knowledge.

Instead, you have to first stop it yourself, then run your Resource Manager deployment script, then start it again manually. Ugh.

This sort of thing makes me hesitant. I love the *idea* but the implementation makes me feel like it is not really conscientiously done.

Baloogan
Dec 5, 2004
Fun Shoe
I've got a winforms app with an ElementHost that I resize based on the size of a WPF UIElement inside the ElementHost.

Then I get an exception sometimes when this resizing is triggered

I guess this leads to an infinite loop where changing the size of the ElementHost changes the WPF UIEelement's size that thus then changes the ElementHost's size and then looping over and over

I get

quote:

An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationCore.dll

Additional information: An infinite loop appears to have resulted from repeatedly invalidating the TimeManager during the Layout/Render process.

I want to size the ElementHost dynamically, but I want to avoid this exception. Any ideas?

chippy
Aug 16, 2006

OK I DON'T GET IT
So I just discovered that you if you try and set a lazy loaded navigation property to null if it hasn't previously been accessed, the change doesn't save because the next time the property is accessed it's lazy loaded using the foreign key, reverting it from null to whatever it was previously.

Sources:

http://stackoverflow.com/questions/25169678/set-navigation-property-to-null-ef-6
http://stackoverflow.com/questions/22557699/entity-framework-5-does-not-clear-navigation-property

The workarounds are to either load eager load the property in the first place, or set the foreign key property instead of the navigation property.

But doesn't this go against the idea that Entity Framework is meant to let you just work with objects without having to worry about the details of how its actually being persisted? If you're having to make a point of doing stuff like this, then surely you're having to pollute your domain with the specifics or your data access layer. It feels wrong to me. Am I wrong?

I also find it strange that I've only just run into this after years of working with EF.

chippy fucked around with this message at 13:23 on Sep 16, 2016

EssOEss
Oct 23, 2006
128-bit approved
Leaky abstractions are leaky! It is not nice but it is a fact of life.

biznatchio
Mar 31, 2001


Buglord

Baloogan posted:

I want to size the ElementHost dynamically, but I want to avoid this exception. Any ideas?

Assuming you want the UIElement to drive the show completely, you could put the UIElement you want to host inside a ScrollViewer to insulate it from the size changes of the ElementHost. That will allow the UIElement to dictate its size without going into an unfortunate loop of responding to the size changes, since being inside a ScrollViewer will result in the target UIElement always getting infinite as the layout available size.

raminasi
Jan 25, 2005

a last drink with no ice
Is an indexer that creates a new object every time it's called as much as an API horror as I intuitively feel like it is? I was expecting Object.ReferenceEquals(customCollection[0], customCollection[0]) to always return true, but I just got burned by something because it actually always returns false.

Night Shade
Jan 13, 2013

Old School

raminasi posted:

Is an indexer that creates a new object every time it's called as much as an API horror as I intuitively feel like it is? I was expecting Object.ReferenceEquals(customCollection[0], customCollection[0]) to always return true, but I just got burned by something because it actually always returns false.

If customCollection is a collection of structs I think this makes sense. Object.ReferenceEquals doesn't have an overload for value types which means if you're passing in two structs like this they'll be boxed separately, which means you now have two references to different boxes containing the same value which means they aren't actually the same reference.

If it's a collection of objects then what the gently caress.

raminasi
Jan 25, 2005

a last drink with no ice

Night Shade posted:

If customCollection is a collection of structs I think this makes sense. Object.ReferenceEquals doesn't have an overload for value types which means if you're passing in two structs like this they'll be boxed separately, which means you now have two references to different boxes containing the same value which means they aren't actually the same reference.

If it's a collection of objects then what the gently caress.

Nope, it's a reference type.

In verifying this by checking the API documentation, I also learned that they're IDisposable, despite not once being used as such in a single shred of example code :psyduck:

Night Shade
Jan 13, 2013

Old School

raminasi posted:

Nope, it's a reference type.

In verifying this by checking the API documentation, I also learned that they're IDisposable, despite not once being used as such in a single shred of example code :psyduck:

:stonk:

So the indexer of a collection is counter-intuitively generating new instances of a class that wants timely cleanup, and even that part is an afterthought in the documentation.

Part of me doesn't want anything to do with whatever it is you're using and part of me is morbidly curious about what it is.

Night Shade fucked around with this message at 07:22 on Sep 18, 2016

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings
I am legitimately curious about the intent here. Like is

myClass[0] going to have a different return than myClass[1]?

Is this used in some sort of factory-type manner?

myFactoryClass[MyEnum.Flag] ?

raminasi
Jan 25, 2005

a last drink with no ice
There wasn't an intent; I reported it on their forums and they said it was a bug. The "fix," of course, wasn't to fix the bizarre indexer behavior, but to change the way these temporary objects work so that you wouldn't notice they were temporary unless you were looking real hard. Basically, the following example code was originally given:
C# code:
var thing = thingCollection[0];
thing.Setting1 = 6;
thing.Setting2 = 12;
thing.CommitSettingChanges();
but it wasn't working for me and some other users: No changes were ever committed. I did some digging and figured out that this (which is what we were doing) doesn't work:
C# code:
thingCollection[0].Setting1 = 6;
thingCollection[0].Setting2 = 12;
thingCollection[0].CommitSettingChanges();
and reported it.

So now, in the next version of the API, CommitSettingChanges will be automatically called whenever you set a property.

Adbot
ADBOT LOVES YOU

22 Eargesplitten
Oct 10, 2010



What's the point of a getter and setter if the syntax for calling them is the same as getting the variable if it were a public variable? I thought the point of getters and setters was to make sure that nothing outside that class could access the variable without going through a specific method call.

Also, why can't I set a variable to be private and then make the getters and setters public? Coming from Java, this whole thing seems weird.

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