|
Inverness posted:Do you know why Microsoft isn't open-sourcing everything for Desktop too? twodot fucked around with this message at 23:12 on Nov 14, 2014 |
# ? Nov 14, 2014 23:09 |
|
|
# ? May 30, 2024 04:06 |
|
Gul Banana posted:Will T As {Structure, New} now be allowed? that'd let us differentiate between the stronger- and weaker-construction-guaranteeing types. Your interpretation is correct. Here's my understanding of your proposal. On the declaration side, if you're in a method body where you have "T As Structure" then you're allowed to do the things that call INITOBJ like "Nothing" and "default(T)" and arrays and List(Of T).Capacity, as normal. But when you have "T As {Structure, New}" then you're disallowed from doing anything that would call INITOBJ, and you're given assurance that T does have an explicit public parameterless constructor. On the consumption side, if you try to pass a type TYPE1 as an argument for "(Of T As Structure)" then it works as normal. But if you try to pass TYPE1 as argument for "(Of T As {Structure, New})" then this is only allowed if either TYPE1 is a structure with an explicit public parameterless constructor, or TYPE1 itself is a generic type parameter with the {Structure, New} constraint. The intent of your proposal is so that no one writes a parameterless constructor under the belief that this will always be called, but then does something that fails to call it. It's kind of strange because library authors will have to do the {Structure, New} work at no benefit to themselves, solely to help callers. Also strange because it doesn't catch INITOBJ cases done by the caller without going via generic methods. One unknown is whether the metadata format itself can accommodate both "New" and "Structure" constraints (i.e. whether their bitfields don't clash). A bigger unknown is whether it's possible to catch all things that might call INITOBJ both directly and indirectly. That seems really hard.
|
# ? Nov 15, 2014 00:01 |
|
Munkeymon posted:If you mean Forms, I think that'd entail all of Windows from some of the stuff hackbunny has been saying in his YOSPOS thread. twodot posted:This is a good question, and I don't know the answer. I expect it's almost certainly just a matter of effort. Desktop has complicated features which we don't want to support, but have to because of compatibility, Fusion being the best example. Open sourcing Desktop sources isn't any extra work (edit: well reviewing pull requests is some work I suppose), but it kind of fucks with the branding if it's open source, but doesn't have the cross platform support. Also while .NET Native doesn't use coreclr.dll, the surface area it supports is the CoreCLR surface area, so I think there's a desire to move people in that direction. From my understanding, WPF uses MILCore at the low level to render everything with DirectX. I assume most of the work would be in making an OpenGL implementation of this for Mac and Linux. Most of the higher level stuff should work fine though, right?
|
# ? Nov 15, 2014 01:57 |
|
ljw1004 posted:The intent of your proposal is so that no one writes a parameterless constructor under the belief that this will always be called, but then does something that fails to call it. It's kind of strange because library authors will have to do the {Structure, New} work at no benefit to themselves, solely to help callers. Also strange because it doesn't catch INITOBJ cases done by the caller without going via generic methods. One unknown is whether the metadata format itself can accommodate both "New" and "Structure" constraints (i.e. whether their bitfields don't clash). A bigger unknown is whether it's possible to catch all things that might call INITOBJ both directly and indirectly. That seems really hard. you're right, the burden and benefit go in the wrong places. i'm just kind of grasping at straws here because i care more about static analysis guarantees (like: object won't exist without its constructor being called) than being able to type New SFoo() instead of SFoo.Create() we've got some fairly monolithic codebases, so if {Structure,New} did become possible we'd use it internally and alleviate the issue. i understand that might not be a niche worth supporting!
|
# ? Nov 15, 2014 07:37 |
|
Inverness posted:From my understanding, WPF uses MILCore at the low level to render everything with DirectX. I assume most of the work would be in making an OpenGL implementation of this for Mac and Linux. Most of the higher level stuff should work fine though, right? Silverlight demonstrated that a XAML implementation is possible without DirectX - WinRT is more closely related to Silverlight than WPF, too, at least in terms of API subset. I don't think they'll open source either, though. This might be somewhat uncharitable toward Microsoft, but my guess is that their .NET strategy goes something like this: 1) we own the enterprise desktop. there's nothing else as good as wpf OR forms out there, so we don't have to attract new developers to them. no major investment and keep things closed. 2) mobile is big and growing bigger, and we've got low marketshare - therefore it's a major growth opportunity. invest heavily, attempting to leverage our existing platform (which must therefore remain closed). 3) in server/cloud we're competing with other heavyweights; it's all very back and forth. a lot of people are refusing to touch asp.net because they don't Do license fees for servers or upfront IDE costs. if we get some of those people using the OWIN stack, it's a selling point for Azure, where this stuff integrates really nicely; Azure is on decent footing against the other clouds but could certainly use advantages like that. Another example: note that the open source stuff includes WCF *client*, but not WCF *server* - that's another case where the enterprises that host WCF services have no real competition other than step down to HTTP/REST services, which falls under 3 above. Microsoft isn't interested in giving out stuff which is already a lock-in competitive advantage (this is not an attack: why *should* they be?). There are some real benefits to openness of the stack, both to Microsoft and to Microsoft developers. Unfortunately, the first party wouldn't benefit so much in the (rather large) use case of enterprise line-of-business development. The people inside Microsoft who push for open stuff - more power to them but either they aren't interested in opening up business-desktop and internal-server stuff or, more likely, they aren't allowed because it's a different segment of the business with a different (non-growth) model.
|
# ? Nov 15, 2014 07:53 |
|
ljw1004 posted:For VB/C#, here are complete lists of all new language features in C#6 and VB14. Hey I just thought of a feature I'm interested in, relating to null propagation. I'd like the same ideal to be applied to function calls, or potentially just events? I hate having to check if an event is null every time, and I'd much rather someEvent?() or similar syntax! Jewel fucked around with this message at 08:07 on Nov 15, 2014 |
# ? Nov 15, 2014 08:01 |
|
Inverness posted:I meant, Forms, WPF, and the whole Desktop CLR.
|
# ? Nov 15, 2014 16:37 |
|
I'm trying to use .net MVC with Entity Framework code first to an existing MYSQL database. I'm just trying to set it up at the moment. I can create my EF classes but when I try to create a controller I get... --------------------------- Microsoft Visual Studio --------------------------- Error There was an error running the selected code generator: 'Unable to retrieve metadata for 'proto_15Nov_2.Models.bs_business'. Sequence contains no matching element' --------------------------- OK --------------------------- I can access the dbcontext with code:
When I try the simple steps here https://blogs.oracle.com/MySqlOnWindows/entry/howto_using_mysql_for_visual I get this error at the end of the wizard. --------------------------- Microsoft Visual Studio --------------------------- Error HRESULT E_FAIL has been returned from a call to a COM component. --------------------------- OK --------------------------- I've tried all the techniques found when you google ".net mvc mysql entity framework", but nothing works. Is Entity Framework and MySQL always going to be a flaky match or do I just need to learn a poo poo load more? Im thinking of moving to SQL Server instead, is it just a matter of finding a host that provides it? Theres no other cost involved?
|
# ? Nov 15, 2014 21:38 |
|
bpower posted:Is Entity Framework and MySQL always going to be a flaky match.... Almost assuredly, yes.
|
# ? Nov 16, 2014 02:09 |
|
Bognar posted:Almost assuredly, yes. Whats the recommended way to connect to mySQL in .net mvc? I don't fancy writing a poo poo load of boring data access code. I can move to MSSQL but there'll be a bit of resistance.
|
# ? Nov 16, 2014 02:34 |
|
bpower posted:Whats the recommended way to connect to mySQL in .net mvc? I don't fancy writing a poo poo load of boring data access code.
|
# ? Nov 16, 2014 02:38 |
|
Uziel posted:I've never accessed mySQL via .net, but which is the path of least resistance? Writing boring data access code, dealing with the Entity and mySQL issues, or moving to MSSQL? Welp, I guess we're moving to MSSQL.
|
# ? Nov 16, 2014 02:49 |
|
Jewel posted:Hey I just thought of a feature I'm interested in, relating to null propagation. I'd like the same ideal to be applied to function calls, or potentially just events? I hate having to check if an event is null every time, and I'd much rather someEvent?() or similar syntax! Note: although the ?. operator is built into C#6 and VB14, the warning squiggle and codefix in this video are not built in. I wrote them myself via a simple "analyzer" - I put the source code here on github. For me the single most important feature of VS2015 is that you can write your own refactorings, analyzers and code-fixes. PS. VB14 has the syntax "PropertyChanged?(args)" that you suggested but C#6 doesn't. That's because it would be ambiguous in C# with the ternary operator "b ? (args) : elseclause"...
|
# ? Nov 16, 2014 07:34 |
|
PropertyChanged?.Invoke is a very neat syntax, and I'm glad you've made it easy to add your own refactorings. Wonder if that'll cut into resharper sales.
|
# ? Nov 16, 2014 11:30 |
|
While we're on the subject, is there some reason that the strategy of avoiding null-checking PropertyChanged via assigning a no-op delegate on construction hasn't gotten more traction? Is there some serious penalty to it that I'm unaware of?
|
# ? Nov 16, 2014 17:51 |
|
GrumpyDoctor posted:While we're on the subject, is there some reason that the strategy of avoiding null-checking PropertyChanged via assigning a no-op delegate on construction hasn't gotten more traction? Is there some serious penalty to it that I'm unaware of? Of course in most cases the compiler will cache the allocation of lambdas that don't capture variables. Even then you're basically relying on compiler optimizations to not totally waste memory which I consider bad practice. You could avoid that by declaring static variables for each event type to hold the no-op delegates for each, but then that seems like more effort than just doing the null check. Finally, use a method to handle the null check, but that is only really useful for generic event delegates and prevents you from being able to only allocate EventArgs if the null check passes. For an event invoked frequently this is wasteful if there are no handlers. TL;DR: Manual null check is more boilerplate but it avoids memory wastes or gotchas that can crop up with other approaches. Edit: This made me realize an important question. If I do MyEvent?.Invoke(new MyArgs()), then do the args only get allocated if MyEvent is not null? Inverness fucked around with this message at 20:24 on Nov 16, 2014 |
# ? Nov 16, 2014 19:26 |
|
GrumpyDoctor posted:While we're on the subject, is there some reason that the strategy of avoiding null-checking PropertyChanged via assigning a no-op delegate on construction hasn't gotten more traction? Is there some serious penalty to it that I'm unaware of? It's minutely slower. I always initialize my events as "public event EventHandler OnButtz = delegate { };". Harder to get snagged on event related rough edges.
|
# ? Nov 16, 2014 22:09 |
|
I just ran Visual Studio Ultimate 2013 Update 4, and VS is now barfing up a bunch of errors The ActivityLog.xml shows this: http://pastebin.com/pPGdsm1P Excerpt: pre:Loading MEF components failed with the following exception: The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information. 1) The specified argument cannot be empty. Parameter name: commandContainers Resulting in: An exception occurred while trying to create an instance of type 'Microsoft.VisualStudio.TestWindow.VsHost.PackageContainer'.
|
# ? Nov 17, 2014 04:56 |
|
epalm posted:I just ran Visual Studio Ultimate 2013 Update 4, and VS is now barfing up a bunch of errors I've been clicking past that for a few weeks. Its some nonsense about the IDE writing to a log. It looks fairly harmless, but annoying for sure.
|
# ? Nov 17, 2014 08:02 |
|
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 |
|
bpower posted:I've been clicking past that for a few weeks. Its some nonsense about the IDE writing to a log. It looks fairly harmless, but annoying for sure. I cannot open the Test Explorer window, so for me it's more than just writing to log files
|
# ? Nov 17, 2014 16:27 |
|
Mr. Crow posted:In the world of dumb micro-optimizations this is probably up there. There's a method written at my workplace of this nature: code:
|
# ? Nov 17, 2014 16:53 |
|
Quick rant: Microsoft keeps adding features to the DSC-based release management option, which would be great if the DSC-based option was even remotely loving usable right now. They're ignoring every single existing user of the product, none of which are using DSC.
|
# ? Nov 17, 2014 17:48 |
|
I know it's poo poo but is there even any good alternative to that? For some nontrivial solution, I mean, such as including Windows services, IIS apps, DCOM fuckery and more. All my current experience says "hell no". At the moment, I am planning the deployment process for a new project and am strongly considering just making an Install.exe console app to take care of the whole thing in a way that I know will do the job.
|
# ? Nov 17, 2014 19:05 |
|
Mr. Crow posted:In the world of dumb micro-optimizations this is probably up there. But now you're constructing the EventArgs even if you don't fire the event! You could pass them as Func<EventArgs> but now you're constructing delegates, which was the "problem" we were originally trying to avoid.
|
# ? Nov 17, 2014 19:09 |
|
Sedro posted:But now you're constructing the EventArgs even if you don't fire the event! You could pass them as Func<EventArgs> but now you're constructing delegates, which was the "problem" we were originally trying to avoid. If you're making a game or something, the last thing you want to do is allocate objects you don't need, which is why I do null checks and avoid allocating until after the check passes. That habit remains even when I write other things.
|
# ? Nov 17, 2014 19:23 |
|
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 |
|
Mr. Crow posted:Well your first mistake was writing a game in .NET 99.9999999% of indie games won't see a difference between C# and C++ performance wise.* With .NET Native I suspect there is very little reason to use C++ for hobby / indie game dev outside of learning experience. *= assuming it is competently written. xgalaxy fucked around with this message at 01:48 on Nov 18, 2014 |
# ? Nov 18, 2014 01:45 |
|
Mr. Crow posted:Well your first mistake was writing a game in .NET C# is just fine for the vast majority of games out there. I've had zero performance problems. xgalaxy posted:*= assuming it is competently written. Just take the latest version of Minecraft for example. Ignoring that Java has no value types, some genius behind that didn't realize that it would be a bad idea to use things like immutable types and temporary objects everywhere. That game now allocates 50 MB per second with its latest version which has tanked performance for many people. It's a good example of how design patterns are circumstantial (and Java is bad). Inverness fucked around with this message at 01:56 on Nov 18, 2014 |
# ? Nov 18, 2014 01:53 |
|
After finding a bug with a lambda expression in one of MS's code examples, I did some googling to actually teach myself about them. I want to make sure that I actually understand them. Are C#'s lambda expressions really just anonymous functions? For example, if my understanding is right, this code: C# code:
edit: Trying this out in visual studio, it clearly doesn't work. I'm not sure why, though. All the examples I can find using primitive types assign the function to a variable first and then basically call it like any other function. That seems semi-pointless to me. How can I write inline lambdas using primitives? The MUMPSorceress fucked around with this message at 06:47 on Nov 18, 2014 |
# ? Nov 18, 2014 06:29 |
|
LeftistMuslimObama posted:After finding a bug with a lambda expression in one of MS's code examples, I did some googling to actually teach myself about them. I want to make sure that I actually understand them. Are C#'s lambda expressions really just anonymous functions? Console.Write doesn't have an overload that takes a delegate, so I'm not sure why you think that code would work. What you're doing there would basically be right if you actually called an appropriate method. You see lambdas a lot with LINQ: C# code:
|
# ? Nov 18, 2014 07:17 |
|
GrumpyDoctor posted:Console.Write doesn't have an overload that takes a delegate, so I'm not sure why you think that code would work. What you're doing there would basically be right if you actually called an appropriate method. You see lambdas a lot with LINQ: I think the tutorials assumed I already knew alot about anonymous functions. Can you point me to a guide that will help me uses lambda expressions effectively?
|
# ? Nov 18, 2014 07:31 |
|
You seem to be thinking of them wrong. Imagine I said that I wanted a function to multiply a number by 2. code:
Which is basically a function which operates on x which returns 2*x, or as in our case above f(input) = 2input. A lambda in C# would be the same as the above, the input variable is returned as 2 * input input => 2 * input Most people just write x => 2 * x. "With x as an input, return 2 * x" What you are probably thinking then, is why didn't Console.Write work with my lambda function. Well, a lamba is an anonymous function definition, it doesn't actually call (unless you explicitly do so). Passing it to Console.Write, you could expect Console.Write to call the function in it's body and pass it's own x, but as Console.Write doesn't take a delegate as an overload, this isn't possible. The way you declared x as an int didn't make sense in this context. Think of it this way instead. code:
|
# ? Nov 18, 2014 08:17 |
|
Sedro posted:But now you're constructing the EventArgs even if you don't fire the event! One idea: (source code for this VS2015 analyzer is here)
|
# ? Nov 18, 2014 08:41 |
|
Those one-off analysers are pretty convincing ads for vs2015! Can they be shared with a team via e.g. extension galleries?
|
# ? Nov 18, 2014 11:40 |
|
ReSharper is in trouble when VS2015 comes out. They're going to continue rolling their own static analysis tools and totally ignore Roslyn. [edit] I like that the null propagation operator is called the "Elvis" operator. Adorable.
|
# ? Nov 18, 2014 11:43 |
|
ljw1004 posted:One idea: This is the pattern I use in a MVVM application: code:
Ithaqua posted:ReSharper is in trouble when VS2015 comes out. They're going to continue rolling their own static analysis tools and totally ignore Roslyn. I remember them commenting on Roslyn and saying that it's basically what they do internally anyways. They can hardly afford to abandon or rewrite all of the code centered around their own methods.
|
# ? Nov 18, 2014 14:33 |
|
Here's the blog post by the way if anyone cares: http://blog.jetbrains.com/dotnet/2014/04/10/resharper-and-roslyn-qa/
|
# ? Nov 18, 2014 15:36 |
|
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 |
|
|
# ? May 30, 2024 04:06 |
|
Will Roslyn let me add code at compile-time like PostSharp does? That would be fantastic.
|
# ? Nov 18, 2014 16:40 |