Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Nth Doctor
Sep 7, 2010

Darkrai used Dream Eater!
It's super effective!


Neitherman posted:

I tried adding a reference to my COM DLL and VS yelled at me. It said I'd have to create a NuGet package or something to be able to reference the DLL. Considering this DLL is not one that either me or my company have authored I don't think it's wise to go down that road. Guess I'll just stick to the ole heavyweight ASP.NET stuff.

What's so wrong about rolling your own package around the dll?

Adbot
ADBOT LOVES YOU

jony neuemonic
Nov 13, 2009

Neitherman posted:

I tried adding a reference to my COM DLL and VS yelled at me. It said I'd have to create a NuGet package or something to be able to reference the DLL. Considering this DLL is not one that either me or my company have authored I don't think it's wise to go down that road. Guess I'll just stick to the ole heavyweight ASP.NET stuff.

I'm not sure if it's any help, but you can target the full .NET Framework with ASP.NET Core.

Yes, this is all terribly confusing.

Neitherman
Sep 25, 2006

He will die without safety brief.

Being that I'm so relatively inexperienced at doing web development in general I think it may be for the best that I get something up and running using standard ASP.Net and convert it to Core when I understand it all a little better. I was able to successfully add my COM DLL to my standard project so I'm just going to take it from there.

Gul Banana
Nov 28, 2003

there are several major facets to asp.net core which are getting confused here

#1 the core clr and refactored BCL, sometimes called "core fx" for "core framework". this is the portable reimplementation of .net's VM and libraries which you need to use if you want to run on Mac or Linux; it is not required on Windows where you can keep using .net4.6 as the base if you want. corefx cannot reference COM and this will never change

#2 the new project system and dotnet cli. the cli is optional but useful on Windows where you have Visual Studio, and necessary otherwise. the new project system, "project.json", is the only one the cli understands, and it is necessary if you want to use corefx instead of .net4.6. however, project.json turns out to have been a bad idea which could not be made fully interoperable with the existing .net "csproj" ecosystem; case in point, even when used from visual studio it does not include the capability to reference com dlls (or arbitrary loose dlls at all), even when running on net46 instead of netcore. although in that circumstance it can at least reference a nuget package which, itself, contains the dll.

#3 the asp.net core web framework, with http and middleware and MVC and so on. this can run on either net46 or netcore - but currently there are only templates for doing it on project.json. it can theoretically work fine on csproj, and you can do it by hand - example - but that is too complicated for most purposes. consequently, it has the same issues referencing dlls in the filesystem as described above.

it's kind of a mess, but here's the good news: project.json is being scrapped and the new features it added are being added back to csproj instead. in an upcoming release of the stack, dotnet CLI will instead run on top of csproj and asp.net core will use the csproj system also. at that point, there will be no more difficulty in using COM references or other kinds of interop, as long as you target the Windows-specific net46 clr.

Neitherman
Sep 25, 2006

He will die without safety brief.

Those explanations were surprisingly helpful. Sounds like sticking with the standard ASP.net is truly the best path forward in my case. It's not like I expect to run this application on a non-Windows environment anyhow.

insularis
Sep 21, 2002

Donated $20. Get well, Lowtax.
Fun Shoe
I'm getting back into programming after a 20 year break. My first little "baby's first application" is a Windows desktop app to randomly select an employee out of a list. I have a listbox that allows multiple selections, and then when the button is clicked, it should choose/print to screen one of the names out of only the selected names (not the full list, that part I get).

I've tried this about 20 different ways, and I can't figure out how to do this. What's the proper way to work with a listbox that allows multiple selections? The documentation out there isn't really helping me understand it (I'm probably dumb).

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

insularis posted:

I'm getting back into programming after a 20 year break. My first little "baby's first application" is a Windows desktop app to randomly select an employee out of a list. I have a listbox that allows multiple selections, and then when the button is clicked, it should choose/print to screen one of the names out of only the selected names (not the full list, that part I get).

I've tried this about 20 different ways, and I can't figure out how to do this. What's the proper way to work with a listbox that allows multiple selections? The documentation out there isn't really helping me understand it (I'm probably dumb).

First rule of asking a programming question: Show code.

smarion2
Apr 22, 2010

insularis posted:

I'm getting back into programming after a 20 year break. My first little "baby's first application" is a Windows desktop app to randomly select an employee out of a list. I have a listbox that allows multiple selections, and then when the button is clicked, it should choose/print to screen one of the names out of only the selected names (not the full list, that part I get).

I've tried this about 20 different ways, and I can't figure out how to do this. What's the proper way to work with a listbox that allows multiple selections? The documentation out there isn't really helping me understand it (I'm probably dumb).

Is this for a WinForms app? If so make sure your listbox has the property selection mode set to MultiSimple instead of one. Next in your button code you can use

code:
Random r = new Random();
name.Text = listBox1.SelectedItems[r.Next(0, listBox1.SelectedItems.Count)].ToString();
The field name.Text is just a lable used to display the name of the randomly selected person from the listbox.

Edit: here's a link to a quick project showing the example. https://drive.google.com/open?id=0BxiboKqaTws8RnI3MGt4RUQ1MEk

smarion2 fucked around with this message at 16:24 on Sep 8, 2016

insularis
Sep 21, 2002

Donated $20. Get well, Lowtax.
Fun Shoe

Ithaqua posted:

First rule of asking a programming question: Show code.

Well, here's a bunch of stuff I've tried, but it's pretty useless, as I'm very lost at the moment when it comes to C#

code:
private void button1_Click(object sender, EventArgs e)
        {
            Random RanDy = new Random(DateTime.Now.Millisecond);
           var    public  string[] NamedOnes;
        

        NamedOnes = public ListBox.SelectedObjectCollection SelectedItems { get; }
        List<string> Names = new List<string>();
            foreach(object element in NamedOnes)
            {
                Names.Add(listBox1.GetItemText(listBox1.SelectedItems));
            }
            
            int RandomPosition = RanDy.Next(Names.Count - 1);
            string TheChosenOne = Names[RandomPosition];
# string textValue = ((ListBoxItem)listBox1.SelectedItems).Content.ToString());
# richTextBox1.Text = TheChosenOne;

insularis
Sep 21, 2002

Donated $20. Get well, Lowtax.
Fun Shoe

smarion2 posted:

Is this for a WinForms app? If so make sure your listbox has the property selection mode set to MultiSimple instead of one. Next in your button code you can use

code:
Random r = new Random();
name.Text = listBox1.SelectedItems[r.Next(0, listBox1.SelectedItems.Count)].ToString();
The field name.Text is just a lable used to display the name of the randomly selected person from the listbox.

Edit: here's a link to a quick project showing the example. https://drive.google.com/open?id=0BxiboKqaTws8RnI3MGt4RUQ1MEk

Wow, okay, that was MUCH simpler than what I thought I needed to do. It worked perfectly. Thank you very much, I think that just helped me understand a number of different concepts. Anyone have any book recommendations on C# for WinForms?

smarion2
Apr 22, 2010

insularis posted:

Wow, okay, that was MUCH simpler than what I thought I needed to do. It worked perfectly. Thank you very much, I think that just helped me understand a number of different concepts. Anyone have any book recommendations on C# for WinForms?

No problem! You will be surprised how much you learn just from messing around and downloading example apps to see how other people do things. That's how I learned at least.

Edit: Also, welcome back to the programming world :)

smarion2 fucked around with this message at 18:08 on Sep 8, 2016

insularis
Sep 21, 2002

Donated $20. Get well, Lowtax.
Fun Shoe

smarion2 posted:

No problem! You will be surprised how much you learn just from messing around and downloading example apps to see how other people do things. That's how i learned at least.

Edit: Also, welcome back to the programming world :)

Thanks ... I'll just build off this and make my next steps to have it read the employee list out of a file and populate the listbox, add some generated graphics to it, add some error handling on what to do if nothing is selected, then add a better psuedorandom routine (as I understand it, the default .NET one is just based off the clock). I should get some decent learning mileage off of this.

Zero The Hero
Jan 7, 2009

insularis posted:

Wow, okay, that was MUCH simpler than what I thought I needed to do. It worked perfectly. Thank you very much, I think that just helped me understand a number of different concepts. Anyone have any book recommendations on C# for WinForms?

No, but I'll recommend moving to WPF if that's possible for you. WinForms is outdated. If it's for a class then whatever, but I don't see any reason to intentionally learn WinForms today.
Also, grab ReSharper. In addition to just improving the Visual Studio experience, it can be pretty educational, as well, especially when you're struggling with syntax. Its suggestions and corrections are really good.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Zero The Hero posted:

No, but I'll recommend moving to WPF if that's possible for you. WinForms is outdated. If it's for a class then whatever, but I don't see any reason to intentionally learn WinForms today.
Also, grab ReSharper. In addition to just improving the Visual Studio experience, it can be pretty educational, as well, especially when you're struggling with syntax. Its suggestions and corrections are really good.

If you use WPF beginner-style, it's just More Confusing Winforms. If you use WPF "correctly", it's "holy poo poo this is way too complicated, gently caress programming". Even experienced developers have problems dealing with WPF databinding and viewmodels.

Zero The Hero
Jan 7, 2009

Ithaqua posted:

If you use WPF beginner-style, it's just More Confusing Winforms. If you use WPF "correctly", it's "holy poo poo this is way too complicated, gently caress programming". Even experienced developers have problems dealing with WPF databinding and viewmodels.

WPF is what I started with back in 2008. We were learning WinForms in class, but I decided to use WPF because it was way easier than what the professor was explaining. Maybe my professor just made things needlessly confusing, but I don't think WPF is as difficult as you're saying - especially to someone who's had any web experience. It's very straight forward.

smarion2
Apr 22, 2010
I agree with Ithaqua in that beginner WPF is just more confusing Winforms. If his app is only In house anyway there's nothing really WPF is going to give you that Win Forms wont. Sure it's an old technology but Microsoft allows you to make Winforms in Visual Studio for a reason, it's still a great way to make a simple program.

You aren't wrong that WPF isn't that much harder but for someone who's coming back to the industry after 20 years it adds unnecessary complexity to the project. Once he feels comfortable with C# and his app rewriting it in WPF could be a next step if the scope calls for it.

Inverness
Feb 4, 2009

Fully configurable personal assistant.
You don't have to go the data binding and view model route with WPF. You can do code-behind with WPF just like you do with WinForms.

Be aware though that this is extra heretical and not considered best practice.

Zero The Hero
Jan 7, 2009

smarion2 posted:

I agree with Ithaqua in that beginner WPF is just more confusing Winforms. If his app is only In house anyway there's nothing really WPF is going to give you that Win Forms wont. Sure it's an old technology but Microsoft allows you to make Winforms in Visual Studio for a reason, it's still a great way to make a simple program.

You aren't wrong that WPF isn't that much harder but for someone who's coming back to the industry after 20 years it adds unnecessary complexity to the project. Once he feels comfortable with C# and his app rewriting it in WPF could be a next step if the scope calls for it.

I think WinForms is much harder. It's needlessly complicated, I don't know why anyone would voluntarily use it.

smarion2
Apr 22, 2010

Zero The Hero posted:

I think WinForms is much harder. It's needlessly complicated, I don't know why anyone would voluntarily use it.

Applying the MVC architecture pattern in WPF is absolutely easier than it would be in WinForms, WPF was designed with it in mind. I suppose I would just be worried about someone getting overwhelmed with the XAML WPF uses on top of getting comfortable with C#. If the app is small without a need for a model and controller its just really easy to quickly make something in WinForms.

I really don't think there's a wrong answer to what ever technology he decides to use. If he looks up a quick WPF tutorial and thinks it looks easy enough than great. I would take your advice about not getting a book and trying to master WinForms though.

ljw1004
Jan 18, 2005

rum

smarion2 posted:

Applying the MVC architecture pattern in WPF is absolutely easier than it would be in WinForms, WPF was designed with it in mind. I suppose I would just be worried about someone getting overwhelmed with the XAML WPF uses on top of getting comfortable with C#. If the app is small without a need for a model and controller its just really easy to quickly make something in WinForms.

I've seen the (free OSS) library "MvvmForms" make MVVM work fine for Winforms. Not more complicated than the WPF approach, and indeed maybe simpler.
https://github.com/ActiveDevelop/MvvmForms/wiki

smarion2
Apr 22, 2010
That looks like an awesome project, I"ll have to check it out. Thanks for the link!

Zero The Hero
Jan 7, 2009

smarion2 posted:

Applying the MVC architecture pattern in WPF is absolutely easier than it would be in WinForms, WPF was designed with it in mind. I suppose I would just be worried about someone getting overwhelmed with the XAML WPF uses on top of getting comfortable with C#. If the app is small without a need for a model and controller its just really easy to quickly make something in WinForms.

I really don't think there's a wrong answer to what ever technology he decides to use. If he looks up a quick WPF tutorial and thinks it looks easy enough than great. I would take your advice about not getting a book and trying to master WinForms though.

I don't use MVC architecture with WPF. XAML is great for beginners because they don't need to touch it, they can stick to C# and use the designer for all layout concerns.

Baloogan
Dec 5, 2004
Fun Shoe
How do you change the DPI setting programatically in .NET? We want to take over a user's monitor as a fullscreen game window and we can change the res, but we also want to change the DPI setting in windows.

Baloogan
Dec 5, 2004
Fun Shoe
I've tried


I've tried screwing with the DEVMODE structure using low level calls to the API


pulling my hair out lol

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I have win forms program that I have written that runs on numerous work stations that generates files which are written to specific folders on the network share, which eventually get consumed by various other programs running on the network. I would really like if I could make my application have write permissions to those folders but block the users themselves from accessing them. Is Impersonation the best way to do this?

ljw1004
Jan 18, 2005

rum

Baloogan posted:

How do you change the DPI setting programatically in .NET? We want to take over a user's monitor as a fullscreen game window and we can change the res, but we also want to change the DPI setting in windows.

(sorry I don't know the answer but...)

Q. What effect does DPI setting have? Why are you trying to change it?

I know it affects the way Windows GUI elements are rendered. But you said you're fullscreen so presumably you don't care about this.

I know there are some win32 (gdi32?) API calls that do transformation calculations based on DPI.

I know that changing resolution has an effect on mouse ballistics. Maybe DPI affects this as well? Is this what you're hoping to change? I ended up compensating for it in other ways (sorry can't remember how any more -- it was over a decade ago).

What other effects does DPI have that you want to change?


I always thought that changing DPI required you to log out then log in again so all apps could reload themselves at the correct DPI setting, since Windows apps generally aren't built to dynamically adjust DPI settings mid-flight. This could cause problems for you.

EssOEss
Oct 23, 2006
128-bit approved

Calidus posted:

I have win forms program that I have written that runs on numerous work stations that generates files which are written to specific folders on the network share, which eventually get consumed by various other programs running on the network. I would really like if I could make my application have write permissions to those folders but block the users themselves from accessing them. Is Impersonation the best way to do this?

OS security systems work by controlling which users have access to what data. A program is just a representation of the user's actions. The only way to put data out of a user's control is to give it to another user.

Therefore, instead of sending the files to a network location, I would suggest you send this data instead to some web API on the data-collecting server, that runs as a different user and puts the files into a location that only this different user has access to.

I am not sure how you propose to use impersonation to solve this. Impersonation is just a way to carry forward a user's identity, generally from a client to a server. It does not seem applicable to this scenario.

Calidus
Oct 31, 2011

Stand back I'm going to try science!

EssOEss posted:

OS security systems work by controlling which users have access to what data. A program is just a representation of the user's actions. The only way to put data out of a user's control is to give it to another user.

Therefore, instead of sending the files to a network location, I would suggest you send this data instead to some web API on the data-collecting server, that runs as a different user and puts the files into a location that only this different user has access to.

I am not sure how you propose to use impersonation to solve this. Impersonation is just a way to carry forward a user's identity, generally from a client to a server. It does not seem applicable to this scenario.

My basic idea was to create a user 'MyWindowsAppUser' in group policy and only give this user read and write permission to desired network share. Then impersonate 'MyWindowsAppUser' when the program write to this location. Then go in a removed my regular users permission from the desired network share.

edit: this is an internal app

EssOEss
Oct 23, 2006
128-bit approved
But your app would still need to log in as MyWindowsAppUser, presumably by embedding the credentials somewhere in configuration. Does this not defeat the point? Your "normal" users could still extract these credentials from the app.

Impersonation allows one to extend an existing login session, normally from a client system to a server system. It does not enable you to get past actually having to establish the login session at some point.

If all you wish to do is make the access to the drop folder non-obvious, I suppose this is good enough, though. But be aware that this would not be a real security barrier.

Inverness
Feb 4, 2009

Fully configurable personal assistant.
You could encrypt the login credentials stored in the app and decrypt at runtime.

For an internal app it would be a bit much to expect a user to go to the lengths necessary to obtain the credentials at runtime at that point.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Calidus posted:

I have win forms program that I have written that runs on numerous work stations that generates files which are written to specific folders on the network share, which eventually get consumed by various other programs running on the network. I would really like if I could make my application have write permissions to those folders but block the users themselves from accessing them. Is Impersonation the best way to do this?

You could output a zip file with a password that only your programs know. You could even 'rotate' it by making it the file path + some nonce to discourage fiddling. Yeah, that adds extra complexity to all your internal applications, but it avoids (mis?)using file permissions in a weird, magical and unintuitive way.

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick
So I think I know the basics of async/await, but there's something I'm not clear on. I know that rather than doing
code:
            var x = await Method1();
            var y = await Method2();
            DoSomethingWithXandY(x, y);
I should rather do something like
code:
            var a = Method1();
            var b = Method2();

            await Task.WhenAll(a, b);
            DoSomethingWithXandY(a.Result, b.Result);
instead so that Method1 and Method2 can do their asynchronous things concurrently.

What I'm now curious about is what's the proper way to do this when you want to populate a list of things off an async method, e.g.
code:
            return list.Select(async x => new Something()
            {
                Id = x,
                Detail = await GetDetails(x)
            });

My understanding is that this would effectively make the population of the list synchronous. Off the top of my head, the only thing I can think of is to do something like
code:
            var tasks = list.ToDictionary(x => x, x => GetDetails(x));
            await Task.WhenAll(tasks.Values);

            return list.Select(async x => new Something()
            {
                Id = x,
                Detail = tasks[x].Result
            });

So, firstly, is my understanding correct? And if it is, is my solution correct, or is there a better way to do this?

ljw1004
Jan 18, 2005

rum

beuges posted:

My understanding is that this would effectively make the population of the list synchronous.

No it wouldn't... as a brainteaser, I bet you can figure out WHY it won't be synchronous if you explicitly write out the type of the thing you're returning. (Hint: the "async" modifier on the lambda means its return type is Task<xyz>. Also, note that the "async" modifier isn't needed in your final code sample.)


I've written out some variations below.

code:
// VERSION 1: this is blocking.
// It blocks on each individual element, one by one, as it comes to them.
IEnumerable<Something> blocking = list.Select(x => new Something()
{
    Id = x,
    Detail = GetDetailsAsync(x).GetAwaiter().GetResult()
});


// VERSION 2: non-blocking.
// It kicks off EVERY SINGLE TASK all at once (one for each element), in one huge sweep.
// Then it awaits until every single one of them has finished.
IEnumerable<Task<Something>> outstanding_tasks = list.Select(async x => new Something()
{
    Id = x,
    Detail = await GetDetailsAsync(x)
});
Something[] non_blocking = await Task.WhenAll(outstanding_tasks);


// VERSION 3: stream.
// It produces an "async stream". This is one where the async work is deferred lazily:
// no async tasks at all are kicked off yet. The async work for each element will only
// be kicked off (and awaited) lazily when a consumer awaits the next element from the stream.
// ***
// This is not yet implemented...
// The ".ToAsyncEnumerable()" method exists today in System.Interactive.Async ("IX")
// The ".SelectAsync()" method won't be released until C#7 comes out because it depends on the new C#7 ValueTask
// feature for efficiency.
// The "foreach (await var x in stream)" feature won't be there until C#8, hopefully.
IAsyncEnumerable<Something> stream = list.ToAsyncEnumerable().SelectAsync(async x => new Something()
{
    Id = x,
    Detail = await GetDetailsAsync(x)
});
I've been working C# language features relating to version 3 recently. If you tried to implement .SelectAsync() today in C#6, you could implement it fine, but it would take a lambda of type Func<Task<x,Something>>. This means that for every single element in the sequence it would have to allocate a new Task object, about 64 bytes. Now if GetDetailsAsync involved a network call (say) then you probably wouldn't care. But if GetDetailsAsync *buffered* the results of that network call, so that 1023 times out of 1024 the details were already available, then that Task allocation starts to add up unacceptably - especially when you're iterating over 1000s of elements. What's coming in Dev15 Preview5 (a preview of C#7) is that you can instead make it take a lambda of type Func<ValueTask<x,Something>>. The ValueTask avoids heap allocation for those fast 1023 times.

As for "foreach (await var x in stream)", that's like a normal foreach loop, but it awaits for each next element. I've made a prototype of this, and we discussed it in C# Language Design Meeting just yesterday. Fingers crossed for it getting into C#8.

ljw1004 fucked around with this message at 16:33 on Sep 9, 2016

Calidus
Oct 31, 2011

Stand back I'm going to try science!
It less of a security thing and more a I don't want users to accidentally messing up files or folders. The file password is a interesting idea, I am going to have to see what happens when various 3rd party programs do when they hit a password protected file. I suppose a could write a little web service to manage these files but I was hoping to be lazy.

GoodCleanFun
Jan 28, 2004

Calidus posted:

It less of a security thing and more a I don't want users to accidentally messing up files or folders. The file password is a interesting idea, I am going to have to see what happens when various 3rd party programs do when they hit a password protected file. I suppose a could write a little web service to manage these files but I was hoping to be lazy.

Perhaps you should throw this data in a database which could avoid problems in the future if you ever want to move to the cloud.

Starting to work on a solution with my company for doing this exact thing. We are currently tightly coupled to a network share that must always be up. This doesn't work in a cloud environment when communication issues can occur. We are exploring a NoSQL implementation to resolve this issue.

Mr Shiny Pants
Nov 12, 2012

Calidus posted:

It less of a security thing and more a I don't want users to accidentally messing up files or folders. The file password is a interesting idea, I am going to have to see what happens when various 3rd party programs do when they hit a password protected file. I suppose a could write a little web service to manage these files but I was hoping to be lazy.

You could run the application under a different windows account than the user. This way the program can write to a location but the user won't be able to browse it.

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick

ljw1004 posted:

No it wouldn't... as a brainteaser, I bet you can figure out WHY it won't be synchronous if you explicitly write out the type of the thing you're returning. (Hint: the "async" modifier on the lambda means its return type is Task<xyz>. Also, note that the "async" modifier isn't needed in your final code sample.)

code:

// VERSION 2: non-blocking.
// It kicks off EVERY SINGLE TASK all at once (one for each element), in one huge sweep.
// Then it awaits until every single one of them has finished.
IEnumerable<Task<Something>> outstanding_tasks = list.Select(async x => new Something()
{
    Id = x,
    Detail = await GetDetailsAsync(x)
});
Something[] non_blocking = await Task.WhenAll(outstanding_tasks);

I've been working C# language features relating to version 3 recently. If you tried to implement .SelectAsync() today in C#6, you could implement it fine, but it would take a lambda of type Func<Task<x,Something>>. This means that for every single element in the sequence it would have to allocate a new Task object, about 64 bytes. Now if GetDetailsAsync involved a network call (say) then you probably wouldn't care. But if GetDetailsAsync *buffered* the results of that network call, so that 1023 times out of 1024 the details were already available, then that Task allocation starts to add up unacceptably - especially when you're iterating over 1000s of elements. What's coming in Dev15 Preview5 (a preview of C#7) is that you can instead make it take a lambda of type Func<ValueTask<x,Something>>. The ValueTask avoids heap allocation for those fast 1023 times.

As for "foreach (await var x in stream)", that's like a normal foreach loop, but it awaits for each next element. I've made a prototype of this, and we discussed it in C# Language Design Meeting just yesterday. Fingers crossed for it getting into C#8.

Oh man, that makes perfect sense now, thank you very much! I watched your Channel9 video on ValueTasks the other day and a lot of it went over my head (and it looked like it went over the heads of the two dudes interviewing you also), but things are slowly clicking into place.

xgalaxy
Jan 27, 2004
i write code
Does anyone have a link to an article or a simple github repo that shows how to use MEF with dot net core? I'm looking for something like a simple application skeleton that shows how to create an application that uses MEF to provide services to plugins and for those plugins to extend functionality of the host.

The articles I can find on this subject seem to all be very poor and tend to assume some base knowledge and vocabulary I am clearly missing.

In particular I'm interested in .net core console application using mef.

Gul Banana
Nov 28, 2003

you'll want "MEF 2"; like other core things, it's a rewrite with a different feature set and higher performance
currently it's called Microsoft.Composition and can be used via imports:, but the name is changing back when they fix that

Adbot
ADBOT LOVES YOU

spiderlemur
Nov 6, 2010
Why does debugging any MVC application take 8 - 9 seconds on a reasonably fast machine (SSD, modern i7, plenty of memory)? I tried Core to see if things improved but I can't get at a point where pressing "start debugging" (or even starting without debugging) gives me a page faster than 7 seconds or so.

It makes things kind of annoying to debug when you're changing anything in the C# end and want to run again. Is there a way to speed this process up?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply