|
bpower posted:Is it just me or is a lot of the .Net documentation a bit poo poo? I actually think a good portion of the .Net documentation is well written and informative. The MVC documentation though is pretty bad. The HtmlHelper extensions are the worst since they're mostly overloads with varying numbers of strings and anonymous objects.
|
# ? Dec 5, 2014 16:11 |
|
|
# ? May 17, 2024 06:11 |
|
zergstain posted:After a while of Googling, I haven't been able to get a clear answer on whether QPC() measures CPU time or actual time. I need an operation to occur every 100ms, so I need actual time. If not QPC(), what should I use? The C/C++ thread might be able to help.
|
# ? Dec 5, 2014 16:31 |
|
Inverness posted:New MSDN blog post: Introducing .NET Core. That's pretty interesting. Partial trust was something of a failed promise that we've sort of given up on. It turns out that the OS is much more capable of making promises about security than we are, so all the new stuff is pretty much full trust only. An assembly loaded as partial trust is supposed to have a number of restrictions regarding what it can call and what features it can use, and while defense in depth is good, it turns out some of those promises are hard and require developers to be extremely disciplined (which often they're not). twodot fucked around with this message at 17:37 on Dec 5, 2014 |
# ? Dec 5, 2014 17:32 |
|
aBagorn posted:Should I be flattening in the service layer? I am mainly using that for data access and some calculations that need to be done before objects are saved to the DB. We do all our DTO flattening at the Service/EF layer because we use AutoMapper projections to select only the fields we want from the database. aBagorn posted:I had been serializing to JSON at that layer and passing up to the Web API in that format What? You are serializing before you get to the WebAPI layer? One of the main points of WebAPI is so you can have a Controller Action like code:
code:
|
# ? Dec 5, 2014 17:49 |
|
It's not getting any easier.... I liked that there was one runtime for all your needs. Why did you need to invent the RT stuff? Why didn't you just add it to the framework that was already. The RT stuff is the Windows 8 thing that sits next to .Net right? It is all pretty confusing. Still a shame you gave up on Silverlight, you should have stuck to your guns and kept it instead of this html 5 javascript thingy we have now. Another thing: Are there any plans to make OS level operations .Net compatible? I would love to be able to interface with snapshots, disks etc. Hell writing my own managed VSS provider would be awesome.
|
# ? Dec 5, 2014 17:56 |
|
Opulent Ceremony posted:We do all our DTO flattening at the Service/EF layer because we use AutoMapper projections to select only the fields we want from the database. See, there you go. I was doing it wrong, I figured. Luckily I'm not too far enough along that refactoring is not an issue
|
# ? Dec 5, 2014 17:57 |
|
To be fair Microsoft themselves are probably wondering why they wrote the RT stuff. Granted the Win32 Api is loving ancient, but the RT stuff is just bad. I'd rather use the old Win32 api.
|
# ? Dec 5, 2014 18:13 |
|
twodot posted:Is there any particular reason you need to unload assemblies? I've used it for a windows service, to allow the service to update a library without having to stop/restart the service. As far as I know, there isn't a way to update a library once it's been loaded. I don't know if that's a security issue, but at the time it was the only thing I found that would work.
|
# ? Dec 5, 2014 19:23 |
|
Essential posted:I've used it for a windows service, to allow the service to update a library without having to stop/restart the service. As far as I know, there isn't a way to update a library once it's been loaded. I don't know if that's a security issue, but at the time it was the only thing I found that would work.
|
# ? Dec 5, 2014 19:37 |
|
twodot posted:There's nothing inherently wrong with doing this, it's just that Windows services is not really a target scenario for .NET Core. When you're thinking about .NET Core think about things like Windows Store apps (Phone and Client) or ASP.NET. Ah, got it thanks. I should have read the article first :S
|
# ? Dec 5, 2014 19:50 |
|
So I guess there's no free mocking framework on .net that can stub out concrete classes with non-virtual methods?
|
# ? Dec 5, 2014 19:55 |
|
Forgall posted:So I guess there's no free mocking framework on .net that can stub out concrete classes with non-virtual methods? Not free no. I'm actually kind of hoping now that Roslyn is out there that someone could create a test/mock suite that could mock those things. Any experts on Roslyn / or even Mono.Cecil know if that would be possible? The problem with the two paid libraries that I know of that can do this is that they require you do it in visual studio as a plugin. They don't seem to offer a command line runner at all. Mono support would be nice too. xgalaxy fucked around with this message at 20:05 on Dec 5, 2014 |
# ? Dec 5, 2014 20:02 |
|
xgalaxy posted:Not free no. I'm actually kind of hoping now that Roslyn is out there that someone could create a test/mock suite that could mock those things. https://github.com/Moq/moq4 ?
|
# ? Dec 5, 2014 21:01 |
|
I don't see where Moq allows for mocking non-virtual, static, or even private methods.
|
# ? Dec 5, 2014 21:12 |
|
Forgall posted:So I guess there's no free mocking framework on .net that can stub out concrete classes with non-virtual methods? IIRC the Fakes framework can do that and it's built into visual studio 2012+.
|
# ? Dec 5, 2014 21:19 |
|
Ithaqua posted:IIRC the Fakes framework can do that and it's built into visual studio 2012+.
|
# ? Dec 5, 2014 21:22 |
|
xgalaxy posted:I don't see where Moq allows for mocking non-virtual, static, or even private methods. Apologies. Moq is just the canonical free mock lib I've seen used everywhere. I believe Ithaqua is correct that Fakes can do this, but haven't used it myself.
|
# ? Dec 5, 2014 21:24 |
|
Mr Shiny Pants posted:Still a shame you gave up on Silverlight, you should have stuck to your guns and kept it instead of this html 5 javascript thingy we have now. Flash, Silverlight and co. have been on the way out for some time. The browser vendors started cutting them off years ago, they've been handed their coats and most have had the good sense to slink off to their long nights. Flash is still drunkenly slurring about how it can't seem to find its keys and gosh maybe it should stick around for one more drink but everyone just politely averts their eyes and hopes it gets the message. There was no point in keeping Silverlight around and they made the right call letting it die. Supporting HTML5+JS for native OS UIs is something they did years ago, so why not brink it back I agree it's a little nuts when you have WPF/XAML, but it's a nice olive branch, I guess?
|
# ? Dec 5, 2014 21:37 |
|
Munkeymon posted:Flash, Silverlight and co. have been on the way out for some time. The browser vendors started cutting them off years ago, they've been handed their coats and most have had the good sense to slink off to their long nights. Flash is still drunkenly slurring about how it can't seem to find its keys and gosh maybe it should stick around for one more drink but everyone just politely averts their eyes and hopes it gets the message. Compared to JS and HTML5 WPF/XAML or Silverlight are light years beyond.
|
# ? Dec 5, 2014 22:18 |
|
Silverlight is dead but alive -- a lot of the technical basis -- basically componentizing the BCL and runtime -- for what they are doing in .NET core came from what they did to build silverlight funnily enough.twodot posted:There's nothing inherently wrong with doing this, it's just that Windows services is not really a target scenario for .NET Core. When you're thinking about .NET Core think about things like Windows Store apps (Phone and Client) or ASP.NET. This and also the sorts of service apps they are targeting are the cloud based sort where you have multiple nodes and do rolling updates to get the same sort of effective update without downtime scenario.
|
# ? Dec 5, 2014 22:27 |
|
Mr Shiny Pants posted:Compared to JS and HTML5 WPF/XAML or Silverlight are light years beyond. Not when it comes to cross-platform support which grows overwhelmingly more important every year.
|
# ? Dec 5, 2014 22:47 |
|
twodot posted:For clarity there is an AppDomain, but there is exactly one and everyone lives in the same AppDomain. This means you can't unload assemblies, or load multiple assemblies with the same name and different versions, or other weirdness with loading. Is there any particular reason you need to unload assemblies? As someone who has done a lot of work with App Domains, I'm glad they won't be in .NET Core. People always think "Hurr, I can use app domains to have different versions of the same assembly in the same process no problem", but then they end up serializing custom types, or throwing custom exceptions across app domains and it all goes to pot. I'm also looking forward to the relaxation of the binding policy in ASP.NET 5. I wouldn't mind it going from the normal .NET framework. It's maddening that as soon as you reference System.Net.Http.Formatting (or whatever), you've got to add a binding redirect for the version of NewtonSoft you're using. It's generally a headache too if you're dumping all your DLLs into one folder to run NUnit over. I really don't care if you find Moq 4.4 but you were expecting 4.2.
|
# ? Dec 5, 2014 23:11 |
|
xgalaxy posted:Not free no. I'm actually kind of hoping now that Roslyn is out there that someone could create a test/mock suite that could mock those things. Edit: Constructor is still going to be executed, but I guess Cecil can also be used to clear out its body. Then there's a call to base class constructor... Yeah, it's kind of a pain. Forgall fucked around with this message at 23:17 on Dec 5, 2014 |
# ? Dec 5, 2014 23:13 |
|
twodot posted:Partial trust was something of a failed promise that we've sort of given up on. It turns out that the OS is much more capable of making promises about security than we are, so all the new stuff is pretty much full trust only. An assembly loaded as partial trust is supposed to have a number of restrictions regarding what it can call and what features it can use, and while defense in depth is good, it turns out some of those promises are hard and require developers to be extremely disciplined (which often they're not). So start a new process with different credentials and communicate through a pipe(?) instead if you want to isolate something?
|
# ? Dec 6, 2014 00:22 |
|
Mr Shiny Pants posted:Compared to JS and HTML5 WPF/XAML or Silverlight are light years beyond. Eh, better in plenty of ways, sure, but worse in others. XAML+C# looks like an over-engineered, boilerplate-filled mess compared to HTML+JS if you've been in HTML-land long enough (and use helper libraries, which everyone sane does). HTML+JS is a confusing mess of ad-hoc 'standards' bolted together with a lot of magic behind the scenes that, no, you can't tweak, and of course no type safety which throws XAML+C# people who are used to the compiler telling them about some things that won't work in advance. But you get cross-platform code and performance is going to be similar in many cases. TypeScript can help a lot with the C#->JS transition, SASS/LESS/WHATEVER can help make CSS less painfully awful and good templating engines make HTML easier to manage as components instead of monolithic documents.
|
# ? Dec 6, 2014 00:36 |
|
xgalaxy posted:To be fair Microsoft themselves are probably wondering why they wrote the RT stuff. Granted the Win32 Api is loving ancient, but the RT stuff is just bad. I'd rather use the old Win32 api. Custom language stuff like that irks me. They could have designed it around new C++ standards to help promote it but nope. Sure there is some library that lets you use the stuff without C++ CX, but it's never given me the impression that it was anything but a second-class citizen. I feel like this whole nonsense happened because of internal rivalry bullshit. C# would have been better for that kind of thing. twodot posted:For clarity there is an AppDomain, but there is exactly one and everyone lives in the same AppDomain. This means you can't unload assemblies, or load multiple assemblies with the same name and different versions, or other weirdness with loading. Is there any particular reason you need to unload assemblies?
|
# ? Dec 6, 2014 01:31 |
|
xgalaxy posted:Not free no. I'm actually kind of hoping now that Roslyn is out there that someone could create a test/mock suite that could mock those things. Conceptually, the mocks have to be either [1] created at source code which VS then compiles as part of your project, or [2] created as a post-build step by examining IL and spitting out additional assemblies, or [3] created at runtime. Roslyn doesn't enable either two things. The best you'd do with Roslyn is, once again like [1], write a VS plugin "VS Single File Generator" (also known as "Custom Tool" in the Solution Explorer Properties Dialog). Your plugin might use Roslyn's help to analyze the user's source code and discover what additional source code to spit out. But that's it.
|
# ? Dec 6, 2014 02:36 |
|
I've got a piece of code that uses app domains and assembly unloading- unsurprisingly, it's a plugin loader system. It supports multiple versions of the same types, wants to keep runs isolated, etc. (Why is this all in one process? Because my project is, itself, a visual studio plugin...) The feature is effective but very niche and complex to use. I'm not surprised to see it cut from Core
|
# ? Dec 6, 2014 07:15 |
|
Munkeymon posted:So start a new process with different credentials and communicate through a pipe(?) instead if you want to isolate something? Inverness posted:No particular reason. I never got a chance to see how it might be useful. Why did .NET even support appdomains in the first place? To have different trust levels in the same process? What did it offer over using a separate process and some form of IPC?
|
# ? Dec 7, 2014 00:38 |
|
twodot posted:I'm not sure what the answer is historically, but AppDomain creation is almost certainly faster than process creation/startup. Process creation is fast, but I've certainly run into scenarios where it was a measurable piece of my runtime. AppDomains have other performance benefits over process creation since string interning is shared across AppDomains (this make locking on string a bad idea). AppDomains predate partial trust, so partial trust isn't the reason.
|
# ? Dec 7, 2014 05:34 |
|
Inverness posted:I can't think of a scenario where creation time would be a real factor when it comes to AppDomain versus a separate process. If you were doing a bunch of small things frequently you would use pooling and job queuing like with threads, no? Communication speed between processes would be the bigger concern I think. I've rarely ever used IPC so I don't know how well that would work.
|
# ? Dec 7, 2014 07:13 |
|
I'm using Autofac with an MVC project. I need to provide a value from HttpApplication.Request to the container - it needs to be used elsewhere in the hierarchy, possibly from components which don't know anything about ASP.NET. Something like:code:
|
# ? Dec 7, 2014 21:24 |
|
You need the UserHostAddress for each user, right? I believe App_Start is called one time, when the application, uh, starts, so it's user agnostic. Why not just have the constructor for ButtModule get the user host address per request itself?
|
# ? Dec 8, 2014 01:40 |
|
The problem is that ButtModule is dynamically loaded and Application_Start will have no idea it even exists (usually with RegisterAssemblyModules and a dynamically loaded assembly). Likewise, ButtModule does not know that it's being used in ASP.NET (or at least I'd like to avoid explicitly referencing/checking it). Can Autofac inject into a module constructor? I could maybe find a way to pass those values as parameters.
|
# ? Dec 8, 2014 03:38 |
|
If ButtModule doesn't know it's being used in ASP.NET, why does it need a user host address? Why shouldn't it reference System.Web if it deals in IP addresses? Seems natural to me...
|
# ? Dec 8, 2014 06:05 |
|
I'm struggling a little with CSS bundling and I hope someone might have an answer for me. I want to use CSS bunding but the resulting CSS path output in the HTML is giving me a 403. From a quick Google it turns out that this can occur when you have named your bundle after an actual path that exists. No problem, I figure I'll just change the bundle name. But doing this breaks all the relative URLs in the CSS. So back to Google. Okay, apparently I can use an override of the Include method to specify a Transform for each Include, one of which will transform the URLs to absolute paths: CssRewriteUrlTransform(). So this kind of works, it definitely rewrites all the URLs, but it doesn't include the application/virtual folder in the URL. So where http://localhost:1234/ApplicationName/ is my actual application URL, the transform will change the URLs so that any relative URL mapping to the Content folder gets rewritten to http://localhost:1234/Content which is clearly not the correct transformation. How can I simply get my files bundled without and have the relative URLs rewritten correctly - this must be an incredibly common requirement, I'm stunned it's not a simpler process.
|
# ? Dec 8, 2014 06:31 |
|
chmods please posted:I'm using Autofac with an MVC project. I need to provide a value from HttpApplication.Request to the container - it needs to be used elsewhere in the hierarchy, possibly from components which don't know anything about ASP.NET. Something like: You may have to add the Autofac.Mvc package if you haven't already.
|
# ? Dec 8, 2014 06:57 |
|
Wardende posted:If ButtModule doesn't know it's being used in ASP.NET, why does it need a user host address? Why shouldn't it reference System.Web if it deals in IP addresses? Seems natural to me... In this case it needs a string identifying the origin of the request for auditing purposes. When used from ASP.NET I use the request IP address, from WCF I have to get the client IP address from the operation context, when used directly I would pass the string "local". Destroyenator posted:I think this does what you're looking for? http://stackoverflow.com/a/15542425/291137 I'll give it a shot at work tomorrow, thanks.
|
# ? Dec 8, 2014 07:30 |
|
chmods please posted:In this case it needs a string identifying the origin of the request for auditing purposes. When used from ASP.NET I use the request IP address, from WCF I have to get the client IP address from the operation context, when used directly I would pass the string "local". Perhaps you need an, uh, IAuditIdentifierProvider and three implementations (one which retrieves the IP address from System.Web, one which gets the client IP, and one which provides "local"), and add that as a dependency to the ButtModule instead of a string. Then you can register the correct implementation in each App_Start.
|
# ? Dec 8, 2014 08:27 |
|
|
# ? May 17, 2024 06:11 |
|
The Wizard of Poz posted:But doing this breaks all the relative URLs in the CSS. Can you not just find/replace in *.css?
|
# ? Dec 8, 2014 15:21 |