|
(from old thread)zerofunk posted:Has anyone ever had issues with different results from using the VS 2012 Test Runner and running mstest.exe from the command line? We have some Automapper Exceptions thrown due to some type mismatches (silly things like float -> double, and int? -> int). These are causing test failures if I run our tests from mstest.exe. When I run directly from VS2012, everything passes. I'm not even sure where to start in figuring out why that is happening. Could be that VS is using one set of Test Settings and running via command line you're using a different (default/none) set of Test Settings. Yet another reason to not use MSTest for unit testing. edit: You can check if VS is using one in the Test -> Test Settings menu.
|
# ¿ Jun 20, 2014 20:15 |
|
|
# ¿ May 2, 2024 03:09 |
|
Going crazy trying to figure this AutoFixture issue out, any ideas would be appreciated! http://stackoverflow.com/questions/24435874/automocking-properties-fails-on-abstract-property
|
# ¿ Jun 26, 2014 17:38 |
|
Anyone have experience hosting external applications in WPF? In the simplest case it's pretty trivial (e.g. notepad) but if it's between two complex apps it quickly gets out of control. Buzzwords: HwndHost, COM, OLE(?), Win32, routing message pumps
|
# ¿ Jul 2, 2014 15:32 |
|
chmods please posted:How much control do you have over the external process? If the answer is "none", I'd recommend building your program as a shell which draws itself around the other windows, it sounds like asking for trouble otherwise. For all intents and purposes, 'none' is the answer. We already do have our program as a shell... sort of. We're basically just calling SetParent on the external app and installing some hooks, but there is some (predictably) hackish stuff put in to account for weird bugs, as well as just some general quirkiness to the look and feel. I'd be curious if you had something else in mind when you said shell, maybe it's something we can do better? Currently exploring / prototyping using HwndHost instead, I realize in a lot of ways it's just substituting old problems for new problems, but if we can solve the new ones, the other advantages it gives would be very beneficial.
|
# ¿ Jul 3, 2014 14:25 |
|
Ciaphas posted:I ended up (after a lot of fuss and bother) going for Option 2, sort of. I turned off autogeneration in the datagrid, made its ItemsSource my list of DataRecords, and, in my xaml code-behind, generated, bound, and added the individual columns by selecting out the name and numeric index of each DataItem. I want to say datagrids don't use virtualizingstackpanels by default so maybe look into that for a quick fix to the performance. There will be some other costs to using one though which you may or may not care about (no smooth scrolling for example). Also I'd strongly recommend not building that by hand in the code behind, the XAML is made for this stuff and that's not what Ithaqa was talking about with option two. Mr. Crow fucked around with this message at 03:56 on Jul 17, 2014 |
# ¿ Jul 17, 2014 03:52 |
|
Ciaphas posted:Yeah, I sort of realized that wasn't quite the Option Two being presented after I posted. I'm new to the whole MVVM thing too though--in fact this is literally my first go at making GUI anything since Visual Basic 6.0 in high school--so it took me a while to realize. You never really explained why Ithaqua's example failed you? It should have worked generally as-is; the second column wouldn't look exactly like you want, but nothing some header styles and templates can't fix.
|
# ¿ Jul 17, 2014 16:02 |
|
gently caress them posted:Is there any rule of thumb as far as MessageBox.show vs actually throwing up some markup and code-behind if you're doing something in WPF? I'm displaying what amounts to a list of "YO these numbers are invalid or were entered wrong" and would rather avoid mucking with markup whenever possible. I'm not really following you're question, but as your application evolves and becomes more complex you'll find you probably want/need to roll your own dialog window, which is pretty simple (is this your question??). The MVVM approach to showing dialogs is to use some sort of IDialogService, MVVM-light has a good system as do the other MVVM frameworks, http://msdn.microsoft.com/en-us/magazine/jj694937.aspx. You may also want to look at the built-in validation framework, for showing validation errors. Otherwise... I'm an idiot and you'll need to expand on your question more.
|
# ¿ Jul 18, 2014 19:27 |
|
Have you considered... talking with the customer and actually figuring out what they want and plan to use it? If they get the DLNs from some spreadsheet and want to just ctrl + v a bunch at a time, having individual textboxes to put each one in would be a nightmare from a usability standpoint. On the flip-side there are benefits to the other approach that was mentioned as well. Doesn't really sound like you're sure what they want, to me.
|
# ¿ Jul 18, 2014 20:47 |
|
Geisladisk posted:Thanks for the suggestions. TopShelf and Puppet definitely looks interesting, I'm looking into them right now. If TopShelf is easy to integrate into the preexisting project, it looks like it'll be a huge timesaver when compared to deploying to vm via batch script. Only 100k? Heh. Try 1000k+
|
# ¿ Jul 24, 2014 21:06 |
|
Knyteguy posted:How do you guys save little reusable blurbs of code to use through various projects? A class library would work with static methods but that seems like a pain to maintain. Does VS have something like this built in? Common libraries, and I have a common personal repo I threw up on github with my own libraries and junk I develop and want to keep track of. If probably blog about it if I had one but
|
# ¿ Jul 29, 2014 04:02 |
|
Mr Shiny Pants posted:It does not do that for me, maybe only in Chrome? ComboBox is unfortunately not very extensible, so you may end up having to re-write it (don't make that assumption yet though). This specific example however probably isn't a big deal. I would look at it's template, you'll have to copy it to modify what you need to modify but just quickly glancing at it you should be able to tweak it and allow the drop down to always show (IsDropDownOpen). Something that will probably determine the pain level is and whether or not this is helpful is how the selected value in the pop-up is updated, whether it tries to resolve the selected item after the textbox loses focus or as it's changing, I don't know. http://msdn.microsoft.com/en-us/library/ms752094(v=vs.110).aspx for the style (template is baked into it).
|
# ¿ Aug 6, 2014 20:55 |
|
If it's not .net I don't know what Roslyn would do but I'm am idiot so...
|
# ¿ Aug 17, 2014 21:26 |
|
Scuzzywuffit posted:which is going to be really embarrassing if the fix is something trivial. With me anyway, it seems like the more hair raising and obnxious the issue, the more likely it is to be something trivial I'm overlooking. Probably worth asking a co-worker for a second set of eyes, or taking a break from it for a day (if possible). Are you able to see if the window is actually closed when you think it is? If the window actually gets Closed() it should be enough to not worry about it, the framework will get rid of it when it's can.
|
# ¿ Aug 18, 2014 14:56 |
|
Ciaphas posted:Is it possible to have a WPF application, depending on certain command line options being present, not bother with the Windows part and just run in the current console (or a new one if run from a shortcut)? I have a project that a customer wants to add some scheduled processing to. I don't see why not, just don't set the StartupUI property and launch/hook your console in a Startup event handler.
|
# ¿ Aug 20, 2014 16:24 |
|
Are either one new? WPF has an issue where it won't compile XAML if some resource your referencing hadn't been built yet, I'm not 100% sure the specific scenario it occurs. Try commenting the data part.
|
# ¿ Aug 22, 2014 01:25 |
|
Fourth'ing the conclusion you don't understand MVVM and are making this way more complicated than it needs to be. Super high-level; your View-Model consumes your Model, your View consumes your View-Model, your Model knows nothing about your View-Model or View, your View-Model knows nothing about your View (there's debate on this specific point, I guess), your View knows nothing about your Model. So exactly like a lot of what gets said about MVVM, the View-Model is the glue between your UI and your Business Logic. A Tartan Tory posted:The button push just tells it to get the Calculated Results? What I should be doing is telling the button to implement a command rather than to get existing results? Your View-Model exposes/provides some sort of general ICommand property, that the View (or multiple views) consumes to perform some action. ICommands are literally just delegates with built-in if-checks (e.g. CanExecute, usually you don't even need this) in the majority case. There is nothing special about them beyond that they are heavily built into the framework to make it easy to delegate function calls, which is why a lot of Controls have a Command property. There are also RoutedUICommands which are basically RoutedEvents + RelayCommands (linked above and re-implemented ad-nauseum across the internet), which is what is built into WPF (RoutedUICommands). Ignore these. quote:View passes information to viewmodel, viewmodel updates model, model updates viewmodel, viewmodel updates view? Is that supposed to be how it works? More or less. quote:Ok so, this is the viewmodel, it initiates itself whenever the button is pressed (how do I represent that in the XAML in view?) and all the inputted data is bound to the name I use in the xaml in view for that textbox it just needs to be assigned to a new variable within this method (how do I access it from the binding to do that then, it can't be within the model as given in the example?). You create your View and your ViewModel independently of each other and tell your View to consume a ViewModel by setting the Views DataContext property to whatever ViewModel.
|
# ¿ Aug 26, 2014 19:58 |
|
A Tartan Tory posted:Honestly, I'm on a massive downer because of this mostly because even after the better part of a week of dedicated study on it, including multiple examples from everyone here and youtube videos etc. I just straight up don't get it. I find it easiest to start with the view first, as it's static and visual both of which make it easier to wrap your head around what you want and what needs to be done. Program your view and keep it super basic, don't worry about specific bindings and gluing a view model together, think about it at that high user level. THEN you can think about what you need to expose on a view model to get your view to work. THEN you can add your business logic. This is kind of backwards from the real world and maybe even "ideal" scenario but when I'm first getting started on a project or helps me get a coherent first step. Also by no means is the view side of things easy, on the contrary it's a rabbit hole of complexity you'll never escape; but if you just want to throw some basic buttons and fields in a window it is fairly simple. Don't get to wrapped up in best practices and trying add more frameworks to "help" you either, get the basics down first then start worrying over having code in the code behind etc.
|
# ¿ Aug 27, 2014 04:29 |
|
Ciaphas posted:Since we're talking about MVVM and WPF and how the rules work, let me ask a question about breaking said rules. My view is developers get to zealous about that (bolded); you can't avoid the code-behind (writing controls, anything to do with dependency objects etc). The primary motivation is to make sure you're not mixing view-model concerns into your view and vica-versa I think. That's the typical pattern for showing notifications etc; though the 'ideal' decoupled way for that specific example would be to use an event bus, which most of the MVVM frameworks have implemented in some form or another. I personally don't view anything wrong with that if it's not all over the place or you're in a small project.
|
# ¿ Aug 27, 2014 15:25 |
|
Factor Mystic posted:This is ObservableCollection<T>: Of all the reasons to hate OC<T> that seems like the silliest.
|
# ¿ Aug 28, 2014 05:35 |
|
Bognar posted:Generally, you shouldn't JSON.stringify if you're using jQuery AJAX to GET. GET commands are (de)serialized as application/x-www-form-urlencoded because they have to be part of the query string (GET request bodies are ignored per the HTTP/1.1 spec). POST requests, on the other hand, can have anything in the body and will usually work on most servers as long as the Content-Type header is correct (e.g. application/json). Missed opportunity to
|
# ¿ Sep 4, 2014 22:29 |
|
[quote="gently caress them" post=""434599217"] I have no clue what is going on. I'm going to just wrap it in a try catch, but honestly, what the hell is going on? [/quote] This is sage advice and generally the right thing to do when youre frustrated with a problem, you're gonna go far!
|
# ¿ Sep 8, 2014 17:31 |
|
Inverness posted:Allocating delegates, from what I assume is a lambda expression, has a memory cost. Even if it's relatively small you'd still be allocating an extra object per event per instance which both wastes memory and puts pressure on the GC. In the world of dumb micro-optimizations this is probably up there. However the annoyance of null checking events everywhere can be circumvented (along with boilerplate event-raising logic) with a simple extension method. This also satisfies the 'performance' inclined as well, and in my opinion is just easier to use/read. code:
code:
Mr. Crow fucked around with this message at 15:48 on Nov 17, 2014 |
# ¿ Nov 17, 2014 15:42 |
|
Inverness posted:Whether this is actually a problem depends on what kind of application you're writing. For most GUI apps, constructing some delegates or event args that wont be used will not have a real impact on performance. Well your first mistake was writing a game in .NET
|
# ¿ Nov 17, 2014 22:05 |
|
Inverness posted:I think that's an interesting concept but would require you to have one of those for each name. I think CallerMemberNameAttribute is more useful in a case like this anyways. @ReSharper, agreed. At best I think they're going to finally have competition in the form of open source refactorings; which means they'll have to step up their game (which is a good thing for consumers/developers). I would expect we'll see one or a couple big open source refactoring/inspection/code-quality projects come out that utilize Roslyn and become defacto Visual Studio 'plugins' for those that don't want to pay for something of a higher quality, better integration etc. One thing I am curious on, I would be curious on the performance of similar competing projects vs ReSharper. (I haven't payed much attention to Roslyn at all) I wonder if Roslyn-based project will outperform ReSharper on large projects.
|
# ¿ Nov 18, 2014 15:39 |
|
Piggybacking off the GetHashCode()-chat, Nthing you really should implement it (and IEqualityComparer) they will make your life so much easier. This is a good explanation why you need to implement GetHashCode() and the problems that can happen if you dont http://stackoverflow.com/a/371348/961464 We can debate all day best algorithms for GetHashCode but the most common-case one I've seen and personally use is the one linked above that Jon Skeet mentions. Basically, pick two primes, multiply them together and add all your public properties hashes. If you use ReSharper, it has a very nice 'Generate Equality Members' code generation template that will automatically generate an implementation of ==, Equals, IEqualityComparer, GetHashCode etc for you.
|
# ¿ Nov 19, 2014 15:52 |
|
bpower posted:Any objections to using EF for the simple crud stuff, and use something else (PetaPoco maybe) for reports/graphs/import/export etc Seems like a horror to me, but whatever you (and your coworkers) are comfortable with I guess.
|
# ¿ Nov 20, 2014 19:17 |
|
xgalaxy posted:Kind of a dumb bikeshedding-ish question but what is more idiomatic C#? 2nd one x1000. I can't think of a compelling reason to use the delegate signature over Action or Func, it might as well be deprecated. Action<int,object> would be preferable to answer your first question.
|
# ¿ Dec 15, 2014 15:49 |
|
Ithaqua posted:Not every project lends itself to TDD, especially if you're entering unknown territory. I was just doing something where I had never used any of the frameworks or libraries period, let alone in concert. Thus, my method of development was "make something just loving work", then "make something else just loving work". I didn't have any clue about what my end goal would be, how classes would be composed (or decomposed), or anything like that. TDD would have been a terrible choice for me -- I would have been writing tests for scenarios that might not even work or be valid, and I would have had to constantly be rewriting huge swaths of tests as I figured out how to plug all of the pieces together into some sort of coherent architecture, which would have killed my enthusiasm for learning any of it. I find this to be the case more often than not with me. I love writing with unit testing in mind but it seems every time I tried to do TDD it was probably just a poor choice, either because I'm not sure where I'm going end up (new frameworks/features/etc.) or because it hasn't 'clicked' for me either.
|
# ¿ Dec 16, 2014 15:16 |
|
Sagacity posted:Please note that unit testing also doesn't necessarily mean that you need to test ALL the details. I've seen people write tests on the level of We literally have hundreds of those kinds of tests (exactly testing auto-props or similarly redundant tests), it drives me up a wall. I think I've generally convinced people they're a waste of time but they still sneak up every now and then, including the huge backlog of old tests. "Does .NET work? Yes? OK, good, moving on!"
|
# ¿ Dec 16, 2014 18:01 |
|
Probably let your unmanaged code manage the memory?
|
# ¿ Jan 26, 2015 19:11 |
|
Counter-argument, I have no issues with ReSharper, it's superb! The XAML support is amazing (among other obvious benefits). UberJumper posted:Does anyone have suggestions for how to name unit testing methods? We started a new project and since are testing guy recently left i am taking over his spot temporarily. Roy Osherove recommends a METHOD_SCENARIO_BEHAVIOR pattern (or I've adopted this implementation of whatever I remember him suggesting). e.g. Butts_HasFooAndCanFoo_ReturnsBar
|
# ¿ Feb 27, 2015 18:03 |
|
I'm getting a really bizarre log4net issue, I'm wondering if anyone has any ideas. Basically, when the (WPF) application loads up, it log4net loads its configuration context from the application config file correctly as expected; then at some point its configuration is switched to an entirely different applications configuration (Box Sync, in this case). Somehow Box Sync starts hijacking the log4net logs and my applications logging is getting dumped into a Box Sync log. The hell?
|
# ¿ Dec 9, 2015 17:47 |
|
Any ideas why I'm getting a 'Cannot access a closed Stream.' here?code:
Edit: the actual error and output streams aren't being Disposed, just the base memory streams for some reason? Mr. Crow fucked around with this message at 18:09 on Jan 14, 2016 |
# ¿ Jan 14, 2016 17:42 |
|
So I guess the issue is the order in which things were getting disposed, calling the constructor with code:
I wonder if Console was doing something to dispose the StreamWriter in the other .exe or if the finally's were being fired in a weird order...
|
# ¿ Jan 14, 2016 18:40 |
|
dougdrums posted:What should the syntax Nothing, it's just an assignment.
|
# ¿ Mar 13, 2017 18:03 |
|
The Wizard of Poz posted:It's not "just an assignment". Oh okay, I thought you could assign expressions to variables, looks like I was mistaken, thanks for the clarification. Also uncurable mlady posted:it's called a 'code smell' Mr. Crow fucked around with this message at 21:54 on Mar 14, 2017 |
# ¿ Mar 14, 2017 21:51 |
|
I find serialization is effortless until it isn't and then it's a huge pain in the rear end, so have some solace there. Usually if you're having problems try and make it simpler and get the basic value types into a class then start building from there. Lists and complex types are always hit and miss depending on which serialization library you're using.
|
# ¿ Mar 16, 2017 17:41 |
|
|
# ¿ May 2, 2024 03:09 |
|
What's the recommend gut check online test website for c# these days? (From a managers perspective)? Is interview mocha any good?
|
# ¿ Jan 31, 2018 23:29 |