|
Does anybody know of a boilerplate or example protect for up-to-date "best practices" in .NET desktop UI, either WPF or any of its successors? I've got an interview in the next few days and while I'm confident about other areas, I haven't really worked on a desktop app since 2017 or so and want to see if there have been major evolutions. (Stuff like, do you still have to either implement INotifyPropertyChanged manually or use the Fody hack, or has something better come up?) NihilCredo fucked around with this message at 05:29 on Jul 13, 2022 |
# ? Jul 13, 2022 05:27 |
|
|
# ? Jun 8, 2024 04:14 |
|
NihilCredo posted:Does anybody know of a boilerplate or example protect for up-to-date "best practices" in .NET desktop UI, either WPF or any of its successors? There are packages like MVVMLight, but I’ve never used it, so I’m not sure exactly what it provides. Might be worth a look, though. I still use NotifyBase for basic observable classes and a ViewModelBase which derives from it and adds in default OK and Cancel commands with overridable command methods as a base for my ViewModels. And, of course, there is ObservableCollection<T> and I’ve added an ObservableDictionary<TKey, TValue> as well.
|
# ? Jul 13, 2022 23:18 |
|
This is more of a Visual Studio 2022 question than proper .NET but does anyone know how to turn off the reference count displays from CodeLens? The internet suggests that disabling CodeLens in Tools->Options should do it, but the screenshot below suggests that that's not the case. I've tried turning CodeLens on/off with no files or solution open and restarting VS but nothing seems to change. Any thoughts?
|
# ? Jul 17, 2022 02:45 |
|
That is indeed the correct way to turn regular CodeLens off, but what I'm very confused by is it showing up for C/C++ in the first place. As far as I can tell from a short investigation (I'm neither using C/C++ nor CodeLens), it should only support unit test status for C/C++ to begin with. Is there maybe an additional "Text Editor > C/C++ > CodeLens" entry with an experimental implementation of CodeLens for C/C++ that you need to turn off separately? If that's not a thing then... maybe some extension is the culprit?
|
# ? Jul 17, 2022 10:14 |
|
SirViver posted:maybe some extension is the culprit? It was an extension! I use the VisualGDB plugin and apparently it has a thing called CodeJumps that puts those reference counts in. That explains why it shows up in C/C++ and also why the normal VS checkbox control doesn't turn them off. Edit->Advanced->Toggle CodeJumps Annotations did the trick. There is also a little tag icon on the upper right corner of each text file that you can click to turn the annotations on/off. Thanks for the prompt to go looking down this path!
|
# ? Jul 17, 2022 13:46 |
|
hello, this isn't so much a writing .net question as a working-with asp.net question trying to automate a process of looking something up on a govt website, which is using asp.net to force you through an "accept" page and then tracking session/state somehow with a bunch of post body vars like "__EVENTVALIDATION". this is making my attempts to just curl it go nowhere. is there an easy way to handle the session stuff if you're trying to write a little powershell script to enrich a csv with data from this site?
|
# ? Jul 25, 2022 23:12 |
|
MightyBigMinus posted:hello, this isn't so much a writing .net question as a working-with asp.net question mystes fucked around with this message at 00:59 on Jul 26, 2022 |
# ? Jul 26, 2022 00:57 |
|
Headless chrome is pretty easy to work with, check out puppeteer on npm.
|
# ? Jul 26, 2022 02:05 |
|
You probably also have to care about some sort of anti-forgery token when POSTing each step (if it's a multi page form that carries state) and the final submit POST. Depending on version and how they've configured it, it might be required as part of the encoded body (if form encoded), as a property on the payload (maybe if a json payload) or possibly in a custom header. Depending on the age of the site, you'll mostly likely find the __RequestVerificationToken in the encoded form body. You can read about this more here.
|
# ? Jul 26, 2022 06:02 |
|
Getting a lot of "nail" vibes from these Python/Rust/Dart/PHP screws... https://fable.io/blog/2022/2022-06-06-Snake_Island_alpha.html
|
# ? Jul 27, 2022 10:24 |
|
NihilCredo posted:Getting a lot of "nail" vibes from these Python/Rust/Dart/PHP screws... F#->Rust->wasm sounds like something that will definitely be bug free and easy to debug
|
# ? Jul 27, 2022 12:05 |
|
Fable should probably stick to js For flutter I think it would be vastly more useful to take an approach like blazor server where as little as possible is actually done within dart so you don't need to transpile That way you could probably use flutter as the gui for .net apps pretty much immediately mystes fucked around with this message at 12:47 on Jul 27, 2022 |
# ? Jul 27, 2022 12:44 |
|
NihilCredo posted:Getting a lot of "nail" vibes from these Python/Rust/Dart/PHP screws... Fable is cool, been working on a small site and it makes web development so much better. All IMHO of course. Too bad the Erlang stuff is dead, I would have loved that.
|
# ? Jul 28, 2022 14:12 |
|
I'm trying to template/render a value from an Azure App Service into the NLog configuration, it's not working and can't figure out what I'm missing. Most of nlog.config: XML code:
I've confirmed that the assemblies in the extensions section are present, they load just fine locally and there are no extension load exceptions in the App Service's AI logs. This is NLog 5.0.1 and the overall project is Net Core 2. Can anyone spot what I'm doing wrong? e: manually registering the ConfigSettingLayoutRenderer in the method like so C# code:
Munkeymon fucked around with this message at 16:33 on Aug 12, 2022 |
# ? Aug 5, 2022 17:11 |
|
Created the basic dockerized ASPNET Core template project and figured out how to manually specify the ports I wanted the app on. Then I added Container Orchestrator Support and figured out how to manually specify the ports I wanted to use. Figuring out how to override these values via documentation wasn't difficult but I was a little surprised the initial port definition seems to be configured only via magic. I initially expected to be able to search my way to changing the value, at first by searching for the port number itself, failing that the launchSettings.json or even some value defined in the .csproj settings. While the launchSettings.json (and later docker-compose.override.yml) were where I would eventually override the values successfully did I miss some bit of initial configuration along the way or is this just a dash of "magic" for new projects?
|
# ? Aug 14, 2022 17:28 |
|
Dr. Poz posted:Created the basic dockerized ASPNET Core template project and figured out how to manually specify the ports I wanted the app on. Then I added Container Orchestrator Support and figured out how to manually specify the ports I wanted to use. Figuring out how to override these values via documentation wasn't difficult but I was a little surprised the initial port definition seems to be configured only via magic. I initially expected to be able to search my way to changing the value, at first by searching for the port number itself, failing that the launchSettings.json or even some value defined in the .csproj settings. mystes fucked around with this message at 19:40 on Aug 14, 2022 |
# ? Aug 14, 2022 19:38 |
|
Anyone ever use https://github.com/graphql-dotnet/graphql-dotnet for implementing graphql in .net? Completely new to GraphQL and I'm trying to use constraint directives for server side api input validation and it's a real pain in the rear end so far. It was suggested I do it this way by the team lead, but I haven't been able to get it working. Is there a better/other way to do validation?
|
# ? Aug 24, 2022 16:15 |
|
I have an ASP.NET project formerly targeting .NET Framework 4.8, which uses Trace.TraceInformation("hello"); for logging. The project was running as an App Service in Azure, with "Application logging (Blob)" enabled and pointing to a storage container. The project was migrated to .NET 6, same App Service in Azure, but no log messages are making it to blob storage anymore. I've read up on https://docs.microsoft.com/en-us/dotnet/core/extensions/logging, and I plan to use Microsoft's official Microsoft.Extensions.Logging, but for now, how can I get my Trace.* calls into blob storage? Googling leads me in all sorts of directions other than the problem I'm having. epswing fucked around with this message at 17:18 on Aug 24, 2022 |
# ? Aug 24, 2022 17:15 |
|
Can someone tell me why code:
code:
I'm running ASP.NET Core 6.0. I tried a bunch of googling, but kept coming up blank. I feel like I'm missing something stupid.
|
# ? Aug 30, 2022 03:23 |
|
wtf is even different between them?
|
# ? Aug 30, 2022 04:27 |
|
insta posted:wtf is even different between them? The div tag is all I can see. The error is probably that the razor parser sucks and there's some minor, unrelated syntax error that's not jumping out at us.
|
# ? Aug 30, 2022 04:49 |
|
yeah you probably have to add a @ to the foreach inside the div so it knows its code
|
# ? Aug 30, 2022 05:03 |
|
Variable 5 posted:Can someone tell me why Second one is nested like @foreach <div> @foreach <tag>. You're missing the underlined @. Opening a HTML tag switches the parser to HTML mode, so you need to preface the inner foreach with a @ to change back to C# mode or it'll treat the foreach as text. As an aside there's a stupid rule in Razor where you can't write @foreach when already inside C# mode and it constantly trips me up. The parser can already tell exactly what's going on, why not let the @ everywhere. Then you can put it everywhere and not get stupid errors when you find you have to wrap your block with another tag. Kyte fucked around with this message at 08:19 on Aug 30, 2022 |
# ? Aug 30, 2022 08:17 |
|
Kyte posted:First one is nested like @foreach foreach <tag> Yeah, that did it. It was driving me nuts that I could do a <div></div> and it would work. Like I said, something stupid (on my part). Thanks!
|
# ? Aug 30, 2022 21:37 |
|
Anyone have any idea what's wrong with this code? We are using a linter and this error won't go away:code:
code:
|
# ? Sep 2, 2022 02:49 |
|
sausage king of Chicago posted:Anyone have any idea what's wrong with this code? We are using a linter and this error won't go away: Phone posting, but it probably wants you to use and/or like code:
|
# ? Sep 2, 2022 03:03 |
|
There should be an option in your editor run an auto-fixer, but most likely it thinks you should use a form like `min is not (null or int or double)`
|
# ? Sep 2, 2022 03:04 |
|
brap posted:There should be an option in your editor run an auto-fixer, but most likely it thinks you should use a form like `min is not (null or int or double)` Yeah, this was exactly it. Thank you.
|
# ? Sep 2, 2022 18:38 |
|
epswing posted:I have an ASP.NET project formerly targeting .NET Framework 4.8, which uses Trace.TraceInformation("hello"); for logging. The project was running as an App Service in Azure, with "Application logging (Blob)" enabled and pointing to a storage container. I've abandoned trying to get Trace.* calls into blob storage, now using Microsoft.Extensions.Logging and in my constructor I have ILogger<BlahController> logger, and I'm doing logger.LogError("foo") in a GET action but nothing's showing up in blob storage. Troubleshooting logging problems is annoying because you can't just check the logs to see what's wrong On the app service I have Application logging (Blob) enabled, Level=Information, with a storage container selected. In my appsettings.json file I have code:
I'm visiting the controller with the LogError calls and looking for blob files to appear in the selected storage container, and I do see a file created recently but it contains a single log message from somewhere other than my codebase. pre:date,level,applicationName,instanceId,eventTickCount,eventId,pid,tid,message,activityId 2022-09-14T13:08:55,Information,my-app-service,af378d,637987577359953373,0,4804,12,Deleting expired heartbeat from instance RD501AC53DB9AF. It last beat at 8/29/2022 4:16:29 PM while the current time is 9/14/2022 1:08:55 PM, epswing fucked around with this message at 16:14 on Sep 14, 2022 |
# ? Sep 14, 2022 16:11 |
|
Anyone have good materials on debugging/cleaning azure credentials stored on your machine by Visual Studio? Been dealing with weird busted interactions with servicebus the last 3 weeks on my local machine where, sending messages works, but receiving doesn't for elusive reasons
|
# ? Sep 20, 2022 19:11 |
|
epswing posted:Am I missing something obvious here? The documentation for what you're trying to do is hidden here. After adding the Microsoft.Extensions.Logging.AzureAppServices package, these are the relevant parts in .NET 6: C# code:
|
# ? Sep 20, 2022 20:05 |
|
Is there a visual studio extension or something which easily lets you manage secrets? I often need to switch connection strings and tokens and stuff between my local dev environment and a remote test environment and it gets to be a pain to go into 7 different projects secret files to update the config. Ideally if I could create different environment configs somewhere, and then just tell VS to swap out the secrets for all the projects with the proper ones for the environment that would be great, but I haven’t been able to find anything that seems to do that
|
# ? Nov 2, 2022 09:13 |
beuges posted:Is there a visual studio extension or something which easily lets you manage secrets? I often need to switch connection strings and tokens and stuff between my local dev environment and a remote test environment and it gets to be a pain to go into 7 different projects secret files to update the config. In a .NET 6 WPF project I can open "Debug Properties" from the Debug menu and configure various launch profiles. It's at least possible to set command line parameters, working directory, and environment variables, as well as some flags for remote debugging and more.
|
|
# ? Nov 2, 2022 09:51 |
|
nielsm posted:In a .NET 6 WPF project I can open "Debug Properties" from the Debug menu and configure various launch profiles. It's at least possible to set command line parameters, working directory, and environment variables, as well as some flags for remote debugging and more. This looks like it should work for me, thanks!
|
# ? Nov 2, 2022 10:01 |
|
Is there a priority queue available for .NET 4.x that has a decent iteration for deletion? I am using one for a scheduler in a Unity project and I just realized I should be canceling out scheduled items on stuff that gets deleted. I saw the implementation did iteration by creating a list of every element and returning it. It spares me invalidating the iterator, but that's still kind of gross. I had this in this project a long time ago and I don't even think the .NET 6 one was even around. I can't use it anyways since Unity's stuck back in .NET 4.6. This one came from a NuGet: https://www.nuget.org/packages/OptimizedPriorityQueue/. I was also using it for an A* pathfinder before I decided to just buy an asset to do it better than I could be bothered to ever refine, so I don't have as much of a compelling reason to use this particular one other than Unity and it's .NET fickleness. I can consider just using a completely different data structure for all it matters.
|
# ? Nov 7, 2022 09:35 |
|
Rocko Bonaparte posted:Is there a priority queue available for .NET 4.x that has a decent iteration for deletion? I am using one for a scheduler in a Unity project and I just realized I should be canceling out scheduled items on stuff that gets deleted. I saw the implementation did iteration by creating a list of every element and returning it. It spares me invalidating the iterator, but that's still kind of gross. I just had a look at the code in that library and it looks like it's only the slow, safe implementation that makes a copy? If you're looking to optimize this for performance you can switch to the FastPriorityQueue implementation it provides in order to ... be faster, at the expense of not getting all those safety checks and needing to take more care around using it correctly.
|
# ? Nov 7, 2022 10:43 |
|
I'd bet you could throw one together for .NET 4 easily by grabbing the .Net Core source code for ImmutableSortedDictionary and ImmutableQueue and then build a wrapper that exposes a normal mutable PriorityQueue interface with an added GetImmutableEnumerator() method that inherently leverages the ImmutableSortedDictionary data field within to provide a stable iterator.
|
# ? Nov 8, 2022 01:27 |
|
Jabor posted:I just had a look at the code in that library and it looks like it's only the slow, safe implementation that makes a copy? If you're looking to optimize this for performance you can switch to the FastPriorityQueue implementation it provides in order to ... be faster, at the expense of not getting all those safety checks and needing to take more care around using it correctly. Ahh I totally forgot about that thing. It's using a classic heap. I guess it can run out of space so I would have to worry about that too (ugh). The kicker is that it's using floats for prioritization while the safe one lets me define what to use (I was using DateTime). So I have to do some refactoring one way or another to use it. I was hoping I could just switch it out tonight and say how it went. Edit: I guess the GenericPriorityQueue gives me what I want. biznatchio posted:I'd bet you could throw one together for .NET 4 easily by I mean, yeah, but that "easily" there is doing a lot of work. Edit edit: The fast implementation implicitly invalidates itself by rearranging the heap after the removal. So I have to start over on each one or else write an alternate removal that would fix the heap after I blow a bunch of holes in it. Plan B here would be to just add a flag that notes "hey I might get destroyed while you're tracking for me so don't panic if you don't find me on the other side." That's what I was trying to resolve the first place and I know about it because I already had a means of testing for it (and then logging a hatemail). Rocko Bonaparte fucked around with this message at 09:17 on Nov 8, 2022 |
# ? Nov 8, 2022 08:45 |
|
Ugh, I always forget that c# iterators don't just let you remove the current element and keep iterating. That blows, because it's a really natural way to express exactly this sort of thing (and it would be easy to do for the heap - copy the last element over the current one, decrement the heap size, and re-heapify, just like with any other removal - the process of restoring the heap property will only touch either some of the elements that you've already iterated over, or some of the elements that you will iterate over in the future, never both, so you can just pick up the iteration where you left off).
|
# ? Nov 8, 2022 13:24 |
|
|
# ? Jun 8, 2024 04:14 |
|
another .net release, another critical workload manifest bug that breaks the cli. dotnet-core-uninstall doesn't look maintained. is there an official or good way to cleanly remove installed sdks and runtimes on a mac?
|
# ? Nov 8, 2022 22:09 |