.net-4.0

How can I make a .Net 4.0 Exe ask the user to download .Net 4.0 framework / redistributable before running this exe?

I thought that latest Matlab does this automatically. I have tested the following exe on a clean Win XP VM: namespace DotNetTest { using System.Windows.Forms; class Program { static void Main(string[] args) { MessageBox.Show("Howdy!"); } } } When I run it on a computer which has all...

WPF ComboBox - SelectionChanged event has old value, not new

C#, .NET 4.0, VS2010. New to WPF. I have a ComboBox on my MainWindow. I hooked the SelectionChanged event of said combo box. However, if I examine the value of the combo box in the event handler, it has the old value. This sounds more like a "SelectionChanging" event, than a SelectionChanged event. How do I get the new value of t...

What happens if I don't specify targetFramework="4.0" ?

In my ASP.Net 4.0 web.config I had the following attribute: <compilation targetFramework="4.0"> If I remove the targetFramework attribute, everything appears to carry on as normal. Under what circumstances does this attribute help me? ...

.NET Efficient way to generate WORD Doc - Server Side

Hello, .NET 4.0 I am looking for the easiest way to generate a Word document on our server. Limitations : Server side I don't want to install word on the server Data source is XML I tried to generate a DOCX with XSLT which is fast and easy but the only way I could find to validate the generated document is to open it with Word and...

In C# should I use uint or int for values that are never supposed to be negative?

Possible Duplicate: Should I use uint in C# for values that cant be negative? Suppose that the MaxValue of (roughly :) ) 2^31 vs 2^32 does not matter. On one hand, using uint seems nice because it is self-explanatory, it indicates (and promises?) that some value may never be negative. However, int is more common, and a cast is...

.net 4 - run code from string - in C# / F# / IronRuby / IronPython.

What ways do I have in .net to run code from string? Console.WriteLine(Compile("1 + 2 * 3")); // results is 7. What other options do we have? C# - Compile the code on runtime? IronRuby / IronPython? F#? ...

Implementing the procducer-consumer pattern with .NET 4.0

With alle the new paralell programming features in .NET 4.0, what would be a a simple and fast way to implement the producer-consumer pattern (where at least one thread is producing/enqueuing task items and another thread executes/dequeues these tasks). Can we benfit from all these new APIs? What is your preferred implementation of this ...

Window out of the screen when maximized using WPF shell integration library

I'm using the WPF Shell Integration Library to create a custom chrome of my wpf app. All is good, but when maximizing the app, 6 or 7 pixels are out of the screen. This is the code I'm using: <Style TargetType="{x:Type local:MainWindow}"> <Setter Property="shell:WindowChrome.WindowChrome"> <Setter.Value> ...

Should I use .NET 4.0 Tasks in a library?

I'm writing a .NET 4.0 library that should be efficient and simple to use. The library is used by referencing it and using its different classes. Should I use .NET 4.0 Tasks tot make things more efficient internally? I fear that it might make the usage of the library more complex and limited since the users might want to decide for the...

Image Resize Aliasing in WPF v4 but not under v3.5

I am using WPF for an image resizing pipeline which has been working beautifully under .NET v3.5. I just upgraded the project to target v4.0 and now all of my resized images are heavily aliased. None of the image pipeline code has changed. Has a default WPF setting changed between v3.5 and v4.0? How do I control the dithering of my res...

IIS6.0 - ASP.NET 4.0 - Default Content Page throwing Error message 401.2

We have a .NET application that was recently converted to .NET 4.0 and then published to IIS 6.0. When we trying going to the url without a page www.blahblahblah.com we get the following error: Server Error in '/' Application. Access is denied. Description: An error occurred while accessing the resources required to serve ...

Bluescreen 0x0000003B during DownloadFileAsync?

Hello again, I've run into a problem with an application I'm developing in C#/.NET. A problem I can't trace down because it causes my system to crash with a BSOD. Here's the minidump: 060310-27066-01.dmp 03.06.2010 19:47:39 SYSTEM_SERVICE_EXCEPTION 0x0000003b 00000000c0000005 fffff8000306d4d0 fffff8800b107640 0000000000000000 ntoskrnl....

default document in web form does not work after using MapPageRoute

I have two strange problems when I use routing in a web form application. Environment: IIS 7.5; .NET 4.0 and Windows 7 64 bit. default document does not work if I use (http://www.)mydomain.com. The exception message is "The controller for path '/' was not found or does not implement IController". However, if I debug in VS 2010 (http://...

Dlls built and strongly named in .NET v 4 cannot be installed in the GAC? - Anyone else experienced this?

Hi, This was driving me a bit nuts as testing strong singing and installation to GAC of assemblies was working on one of my PC's, but not the other. This was the case with snk key files and pfx. They could not be installed via either a drag and drop into the Assembly via explorer, or using the mscorcfg.msc tool. I then realised the te...

Dynamically implementing an interface in .NET 4.0 (C#)

With the new dynamic capabilities in .NET 4.0, it seems like it should be possible to dynamically implement an interface, e.g. given: public interface IFoo { string Bar(int baz); } public class Foo : IFoo { public string Bar(int baz) { return baz.ToString(); } } public class Proxy : IDynamicMetaObjectProvider { private re...

Migrating from LINQ to SQL to Entity Framework 4.0 - Tips, Documentation, etc.

I tried out EF back in .NET 3.5 SP1, and I was one of the many who got frustrated and decided to learn LINQ to SQL instead. Now that I know EF is the "chosen" path forward, plus EF 4.0 has some exciting new features, I'd like to migrate my app to EF 4.0. Can anyone suggest any good resources that are specifically targeted towards 4.0 a...

Visual Studio 2010 crashes opening WPF user control

I am having a problem with Visual Studio 2010 crashing when opening a WPF user control on one computer. Whenever I open any WPF user control or try to create a new WPF user control in our product solution (any project in the solution), Visual Studio crashes. I have uninstalled or disabled all Visual Studio add-ins (such as ReSharper and...

WCF "Instance already exists in CounterSet" error when reopening ServiceHost

I have a working ServiceHost with a single NetTcpBinding and a single endpoint. I .Close() it. Then, I create a new ServiceHost instance with the exact same configuration as the first one. Then, when I try to .Open() the new instance I'm getting this very awkward exception: System.ArgumentException occurred Message=Instance 'LobbySer...

Is it possible to setup a .NET4 webforms route to an asmx endpoint?

Is it possible in my RegisterRoutes method in global.asax, to map some routes to an asmx? Ideally I would like to do something like: routes.MapPageRoute("ServiceSearchCats", "services/search/cats", "~/Services/Search.asmx/Cats"); (and therefore my endpoint for the service becomes "http://mydomain.com/services/search/cats", instead of...

Problems with MembershipUser / System.Web.ApplicationServices when upgrading to .net 4

I have a large vb.net web project that I am trying to updgrade to .net4/VS2010. During compile I get the following error: 'System.Web.Security.MembershipUser' in assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' has been forwarded to assembly 'System.Web.ApplicationServices'. Either a reference ...