|
EssOEss posted:HttpWebRequest has been in .NET since the early days, whereas HttpClient is newer, so I would expect the former to be the lower level primitive - possibly HttpClient might be using HttpWebRequest internally (or at least some of the HttpClient implementations - there are several over the different .NET variations!). Thanks, that is also what I thought. I only use the client when I need to POST some files, that is just waaaay nicer than doing it manually.
|
# ? May 24, 2018 11:06 |
|
|
# ? Jun 8, 2024 16:19 |
|
Essential posted:I learned something today that I wanted to share, just in case it helps anyone else. HttpClient should NOT be used in a using block, even though it implements IDisposable. This can cause some serious performance problems. For us, specifically we had an Azure Function that was scaling up in ways we couldn't understand. It turns out it was due to wrapping an httpclient in a using block. What can happen is it leaves ports open and can even utilize all ports and hang the system up while waiting to free up resources. Yep! You're supposed to reuse the same instance for all requests. Problem is, many if not most parameters that should be per-request are per-client instead, and so you'll be forced to either pool your HttpClients or re-create them over and over. You'd think you could personalize requests at the message handler level, but nope, you're very limited in what you can do. It's a really poor design! Essential posted:I was mistaken in that I thought anything that implements IDisposable should always be in a using block. It's correct, but incomplete: you should always be aware of the scope of the object, and call Dispose as soon as it goes out of scope. For per-function scopes, you have using; for scopes that live longer, for example a field in an object, you'll have to call Dispose yourself at the right time. At a minimum, you'll have to override the finalizer of the object that contains the IDisposable field, but often you'll have to make the containing object IDisposable as well It'll come more naturally to you if you have already experience with manual memory management, e.g. with the RAII pattern of C++. It's no coincidence that C++/CLI turns destructors into implementations of IDisposable.Dispose, instead of finalizers hackbunny fucked around with this message at 12:45 on May 24, 2018 |
# ? May 24, 2018 12:43 |
|
EssOEss posted:HttpWebRequest has been in .NET since the early days, whereas HttpClient is newer, so I would expect the former to be the lower level primitive - possibly HttpClient might be using HttpWebRequest internally (or at least some of the HttpClient implementations - there are several over the different .NET variations!). My information is three years out of date but came from the authors+maintainers of HttpClient. They said that best practice at that time was to have just a singleton HttpClient in your code and re-use it for everything, so that caching and stuff could work as well as possible. (that wasn't possible in some cases where you customized it, but the principle remained that you should use as few instances as possible). And like you say, they confirmed there were different implementations of HttpClient across the different .NET platforms. I know for sure that UWP had an implementation that's as close-to-the-metal of Win10 as possible. I believe that HttpClient got into .NETCore before HttpWebRequest, so I'd expect on that platform that it'd be the other way round.
|
# ? May 24, 2018 15:34 |
|
Given an ObservableDictionary<long, List<string>>, is there a good way in the MVVM model to populate a TabControl so that each tab has the key as the header, and say a ListBox populated by the Value as the contents? Using code-behind, I manually built the TabItems from the dictionary, and created a ListBox from the values as the child of each tab. The scenario is that I have firewall rule dump files created from a shell script that I need to reformat into an excel spreadsheet. The files are named YYYYMMDD_<firewall name> so I want to group all the files with the same date since they are most likely the ones the user is interested in. I’d like to use a TabControl to group dump files by date, but failing that will fall back to a ListView with entries ordered by date descending. Edit: never mind, I ended up going with the ListView in descending date, ascending name order. This allows multiple selection on different dates, if needed. I bind the ListView’s SelectedItems property to the CommandParameter for my two build buttons, and it works quite well, even if the presentation is a bit boring. LongSack fucked around with this message at 00:36 on May 26, 2018 |
# ? May 25, 2018 05:41 |
|
nielsm posted:Speaking of HTTP clients, as far as I can tell HttpWebRequest is the only way to use NTLM authentication with the current credentials? Is that right? If you're using HttpClient you can specify using DefaultCredentials and this will work with 'windows' authentication in IIS. It'll be NTLM or whatever the fallback is
|
# ? May 27, 2018 04:06 |
|
Is it just me or is the code formatting in Visual Studio 2017 community edition really weird, at least for bog standard HTML coding, it does javascript and c# fine. I'm used to the old 2010 edition and it always formatted HTML code really well. But in the 2017 edition it's completely different. I've googled the gently caress out of this and tried all the tips on stackoverflow etc to tweak the formatting. Now after all that it seems to indent tags in a proper manner and adds line breaks automatically, but say I got a <p> tag with text, all the text after the first line break will not be indented to match the rest of the block. This is bugging the hell out of me.
|
# ? May 29, 2018 09:15 |
|
I've got to build a windows app to manage bulk-uploading documents from windows pc's to a web-based document store, but I've not built a windows ui since my borland delphi and vb6 days. I'm looking at c#/WPF and Neutronium so I can at least partially leverage my html/js/etc skills. Does this sound at all reasonable - I build asp.net mvc web apps, console apps and all kind of oddball integrations for my day job, deliberately keeping out of windows ui dev for the longest time, so I don't really know if this is a good choice or not. My end goal is to have admins be able to customise some of the ui with a dsl or json template - I've done a similar thing on websites before, but ui on the web is a lot easier to control than I remember winforms being, so I'm not sure if WPF is a good fit, if Neutronium makes sense in this scenario, or if I'm setting myself up for failure.
|
# ? May 30, 2018 03:20 |
|
mortarr posted:I've got to build a windows app to manage bulk-uploading documents from windows pc's to a web-based document store, but I've not built a windows ui since my borland delphi and vb6 days. Maybe Electron? They ( MS ) use it to build VS Code.
|
# ? May 30, 2018 08:01 |
|
Electron is cool, but if you don't need your application to run on multiple platforms it seems like overkill. If you need to run on Windows and you can't do a web app for business reasons, I would just go check out UWP. You can write UWP with C# and XAML or JavaScript and HTML. https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide
|
# ? Jun 3, 2018 17:16 |
|
Calidus posted:Electron is cool, but if you don't need your application to run on multiple platforms it seems like overkill. poo poo, I hadn't even thought of a store app, that might be a better option than what I was looking at.
|
# ? Jun 4, 2018 08:53 |
|
What was the library for .net framework that was similar to the new channel<T> for .net core but presumably not as performant? It was something that Microsoft made a while ago but (I think) never bothered actually bundling with .net. I can't remember and I'm having trouble googling it. I just tried messing around with channel<T> and it seemed pretty nice but then I realized that System.Threading.Tasks.Dataflow was better for what I was doing. (Incidentally I think someone said that Microsoft might be planning on redoing the Dataflow library based on channel<T> in the future though.)
|
# ? Jun 4, 2018 14:11 |
|
roadhead posted:.NET Core 2 It's actually more embarrassing than you could possibly imagine. All the half-started projects that have been checked into this repo but also removed from the solution? Yea turns out * finds all those and tries to build them, so let that be a lesson, actually read the entire log and don't assume you know what it says. The projects I cared about were building fine, it was the abandoned garbage ones I forgot were even there that were failing.
|
# ? Jun 9, 2018 15:13 |
|
You should stop checking in poo poo that doesn't belong.
|
# ? Jun 10, 2018 11:55 |
Is there a way to create publishing options for plain .net framework console applications that would copy build output to a predetermined ftp location or a local directory, like web apps? The only option VS offers me is ClickOnce which doesn't look good. I could simply copy it myself but the task is to simplify the process so that me and other developers could deploy different configurations without loving up configs and locations over and over again.
|
|
# ? Jun 18, 2018 15:53 |
|
Shy posted:Is there a way to create publishing options for plain .net framework console applications that would copy build output to a predetermined ftp location or a local directory, like web apps? The only option VS offers me is ClickOnce which doesn't look good. I could simply copy it myself but the task is to simplify the process so that me and other developers could deploy different configurations without loving up configs and locations over and over again. Build it into your CI/CD pipeline. If you don't have one, you almost certainly should.
|
# ? Jun 18, 2018 16:00 |
It's a cool idea that was suggested in the company earlier but we're a small data-centric shop with little actual development so right now it sounds like too much work (nobody has the right experience) for little gain, but there are many situations where a little help with manual binary pushing would be very useful.
|
|
# ? Jun 18, 2018 16:47 |
|
It is very simple, especially if you use Microsoft's team tools (TFS or VSTS). Just spend a few hours and do it.
|
# ? Jun 18, 2018 17:32 |
|
dotnet publish might work with netframework apps in addition to netcore ones, I'm not sure. But really, just set up CI/CD. It's an incredible productivity multiplier, even for tiny projects.
|
# ? Jun 18, 2018 17:45 |
|
The person you're talking to likely doesn't have the clout to make that kind of call and is asking for alternative paths...
|
# ? Jun 19, 2018 03:44 |
|
Shy posted:Is there a way to create publishing options for plain .net framework console applications that would copy build output to a predetermined ftp location or a local directory, like web apps? The only option VS offers me is ClickOnce which doesn't look good. I could simply copy it myself but the task is to simplify the process so that me and other developers could deploy different configurations without loving up configs and locations over and over again. Post-build task using robocopy or a simple script you write and build configurations. Simplest to set up. If you don't want it tied to a build, you can write the script then add a "Custom Tool" that shows up in the tools menu and you can run manually.
|
# ? Jun 19, 2018 07:33 |
|
OK this is just Bananas. Sometimes when this form POSTs, things are received just fine in the ASP controller: Sometimes, some random unicode character is appended. The JS console seems to think everything is fine: Here's another random unicode character appended to the form value: Seriously wtf. Edit 1: Only seems to be happening on Edge. It's really keeping our software dept on Edge. It doesn't pay to be at the bleeding Edge of technology. I'm pretty much at the Edge of my rope? Edit 2: ah there's the Edge bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17358578/ quote:When submitting ASP forms using <select><option>tags, the resulting data has an extra character on the end breaking data integrity. This did not happen in 1803, and does not happen in IE or Chrome. quote:We won’t stop the Windows update based on this problem. However, a fix has already been written, and servicing is in progress. I’m not the person responsible for the team writing the servicing fix, but I think the update should be part of the next patch Tuesday, which is (I think) due on the second Tuesday of the month of June. quote:Just to give everyone an update, it looks like when I was told the fix would make it to the next Patch Tuesday, the dev team meant the July patch tuesday and not the June patch tuesday. epswing fucked around with this message at 15:42 on Jun 26, 2018 |
# ? Jun 25, 2018 19:58 |
|
Hey man, forms are such a new addition to HTML that it is totally normal for a browser to break them and schedule a patch for "some months or whenever". On the upside, it's not like any users are affected because, of course, it's Edge.
|
# ? Jun 25, 2018 22:48 |
|
Does anyone actually use Edge? For as long as it's out I've only used it to download Firefox or Vivaldi.
|
# ? Jun 26, 2018 08:56 |
|
EssOEss posted:On the upside, it's not like any users are affected because, of course, it's Edge. Mr Shiny Pants posted:Does anyone actually use Edge? For as long as it's out I've only used it to download Firefox or Vivaldi. Corporate client, they only have Edge and IE installed, and this can't be changed. That bug report suggests this: code:
code:
|
# ? Jun 26, 2018 15:46 |
|
epalm posted:Corporate client, they only have Edge and IE installed, and this can't be changed. Isn't specifying the value the better way to do it in the first place regardless of the bug?
|
# ? Jun 26, 2018 16:06 |
|
I would not call it objectively better - both ways are valid HTML. The long form just allows the option value to differ from the option text, whereas in the short form they are the same.
|
# ? Jun 26, 2018 18:44 |
|
epalm posted:Corporate client, they only have Edge and IE installed, and this can't be changed. That's how you should do it anyway.
|
# ? Jun 26, 2018 23:53 |
|
a hot gujju bhabhi posted:That's how you should do it anyway. That doesn't excuse the bug, as it is perfectly acceptable HTML.
|
# ? Jun 27, 2018 01:00 |
|
necrotic posted:That doesn't excuse the bug, as it is perfectly acceptable HTML. Which they said is fixed, right? My biggest issue with Edge is that updates are tied to OS releases and updates, rather than pushed through the store. If there was a way to do that, they could have got the fix out sooner rather than have to wait for a patch tuesday.
|
# ? Jun 27, 2018 13:33 |
|
Fixed next monthquote:Just to give everyone an update, it looks like when I was told the fix would make it to the next Patch Tuesday, the dev team meant the July patch tuesday and not the June patch tuesday
|
# ? Jun 27, 2018 15:03 |
|
After first being reported almost two months ago.
|
# ? Jun 27, 2018 22:11 |
|
Is there a Roslyn extension that will add a blue squiggly or compiler warning if you're in an async method and calling foo.Bar() when foo.BarAsync() exists? I'm updating a fairly large application which hardly made any use of async/await, when there's a lot of places where it could have been used, so one of the things I'm doing is trying to add in as much async as possible. This is going well in our own code since return types are changing and method names are being changed to ****Async, but I've noticed we're missing a couple of spots at the framework level, e.g. we've converted a method to async, and changed the calls to our own methods to await the new Async versions instead, but there are some spots where we'd call db.SaveChanges() where we should now await db.SaveChangesAsync() instead. I know it's not going to catch everything, but it would still be a nice helper since the Foo/FooAsync naming convention is fairly standard. Alternatively, would anyone have any references to help me build an analyzer that would do this? e: this looks like it might be a good starting point edit2: this looks like it does exactly what i want beuges fucked around with this message at 14:30 on Jun 29, 2018 |
# ? Jun 28, 2018 10:09 |
|
beuges posted:Is there a Roslyn extension that will add a blue squiggly or compiler warning if you're in an async method and calling foo.Bar() when foo.BarAsync() exists? Another extension I love is this: if you're in an async method which accepts a CancellationToken, and you invoke an async method which accepts an optional CancellationToken but you fail to provide it, then it emits a warning.
|
# ? Jun 29, 2018 04:41 |
|
What am I misunderstanding about parsing non-English dates? This returns true on my local machine but not our test server or dotnetfiddle:C# code:
|
# ? Jun 29, 2018 19:41 |
|
CultureInfo behavior depends on the culture data installed in the operating system - it is not a constant. Not sure if it explains this particular instance but maybe a starting point.
|
# ? Jun 29, 2018 20:12 |
|
necrotic posted:That doesn't excuse the bug, as it is perfectly acceptable HTML. I never said it excused the bug but okay?
|
# ? Jul 2, 2018 08:41 |
|
Am I going mad, or is there no simple 'Greater Than' data annotation in ASP.NET? There's Range, and the Data Annotations Extensions library has Min and Max but I can't use that any of those to do greater than zero on a decimal property. Why the gently caress is this not a thing? I realise I can write one but I feel like this is such a simple thing that I shouldn't have to.
|
# ? Jul 5, 2018 12:33 |
|
chippy posted:Am I going mad, or is there no simple 'Greater Than' data annotation in ASP.NET? There's Range, and the Data Annotations Extensions library has Min and Max but I can't use that any of those to do greater than zero on a decimal property. Why the gently caress is this not a thing? How is Min(0) not working for you for 'greater than 0'?
|
# ? Jul 5, 2018 14:09 |
|
Munkeymon posted:How is Min(0) not working for you for 'greater than 0'? Presumably Min(0) would allow zero itself. The easiest workaround would be to define a const that contains the smallest possible positive decimal value, which is 1/(10^28), and use that with Min. C# code:
|
# ? Jul 5, 2018 14:56 |
|
|
# ? Jun 8, 2024 16:19 |
|
If you were to build your first phone app, as a fun hobby project, what would you do? Go native? Xamarin? I've been sort of burned out on my day in and day out programming job and find I've been spending too much time playing video games to wind down. I'd like to instead try building something new/fun as a more productive use of my time. I haven't done ANY phone app development so not sure where the best place to start is. My guess would be xamarin, but I don't know if there are any gotcha's I should be worried about. Obviously c#/.net dev platform is a huge, huge bonus there. Any advice or insight anyone has so I can stop procrastinating is really appreciated. Essential fucked around with this message at 16:57 on Jul 7, 2018 |
# ? Jul 7, 2018 16:54 |