.net-4.0

.NET 4.0 CTP and EF CTP - is it good enough for production code?

I'm very interested in using 4.0 framework and also the Entity Framework 4.0. Currently .net 4.0 is in CTP and I'm EF 4.0 is in CTP Preview. I will not be coding for a few more months, but i'm not so sure that either .net 4.0 or EF 4.0 will be RTM by then. My questions: 1) Regarding Microsoft Products, is CTP usually stable enough ...

Can I use .net 4.0 beta without having vs2010?

Possible Duplicate: Can I use .NET 4.0 beta in Visual Studio 2008? I have VS 2008 professional, and yesterday installed .net 4.0 Beta 1 (without vs2010). I want to try parallel Fx lib, but I don't know how to add .net 4.0 references. It is possible to use 4.0 version without visual studio 2010? ...

Why is ccrewrite.exe not doing anything from the command line?

I've got Code Contracts working fine from inside Visual Studio 2010, but I can't get ccrewrite.exe to do anything useful from the command line. Here's a sample app: using System.Diagnostics.Contracts; public class Dummy { public static void Main(string[] args) { Contract.Requires(args.Length > 0); } } I then compi...

How free can I be in the code in an object invariant?

I'm trying to demonstrate invariants in Code Contracts, and I thought I'd give an example of a sorted list of strings. It maintains an array internally, with spare space for additions etc - just like List<T>, basically. When it needs to add an item, it inserts it into the array, etc. I figured I had three invariants: The count must be ...

Can you use Optional Parameters in code targeting .Net 3.5?

I'm looking to write a library that uses the new optional parameters feature of C# 4.0, but I want to target it to the 3.5 version of th framework. Is this possible? Are optional parameters syntactic sugar in the same way that Extension Methods are? ...

Building .NET 4 projects with Nant

How do I get nant to build projects that target the .NET 4.0 Framework? ...

UnauthorizedAccessException on MemoryMappedFile in C# 4.

Hey, I wanted to play around with using a MemoryMappedFile to access an existing binary file. If this even at all possible or am I a crazy person? The idea would be to map the existing binary file directly to memory for some preferably higher-speed operations. Or to atleast see how these things worked. using System.IO.MemoryMa...

MSDeploy not working ...

Hi, I'm trying to deploy a .NET 4.0 project with Visual Studio 2010 using MSDeploy; however when I right-click on the project, what shows up is the legacy context menu for Visual Studio 2008 ('Publish Website', 'Build Website' etc.) in lieu of the VS 2010 context menu ('Publish', 'Build' etc.). I'm running Windows Vista and IIS 7.0. Id...

dynamic keyword, c# compilation service - how to run code that is not yet available at compile time?

I'm writing a small visualization tool in wpf, the idea is that average users can create interesting visualizations without being programming wizards. I have a controller class that has methods like StartPath(double x, double y) and LineTo(x,y) CurveTo(...) etc. The idea is that a user can type these commands into a textbox and have it...

.NET 4.0 code contracts - How will they affect unit testing?

For example this article introduces them. What is the benefit? Static analysis seems cool but at the same time it would prevent the ability to pass null as a parameter in unit test. (if you followed the example in the article that is) While on the topic of unit testing - given how things are now surely there is no point for code cont...

.NET 4.0 Framework Upgrade Requirements?

What are the requirements for the upcoming .NET 4 release? Searched around for this and couldn't seem to find a definitive answer. Specifically... Will clients have to upgrade their .NET Framework CLR (like from 1.1 to 2.0) to run 4.0-targeted applications? Will ASP.NET require a framework upgrade or will behavior be similar to 2.0 run...

Is it possible to inject values into Workflow Arguments?

I have a .net 4.0 Workflow, which I am hosting myself (just with WorkflowInstance.Run) and when I rehydrate the workflow I would like to initialize some of its internal arguments so that subsequent activities can use these values... How might I go about doing this? ...

When should new .NET projects be designed for .NET 4 Framework

I am preparing to start on a new short-term contract (1-2 months) that involves replacing an Access application by moving it to ASP.NET and SQL Server. I am only responsible for the ASP part and connecting it to the database. The only requirement is that whatever technologies I use be relatively well-known in the area, so that if they ...

Is it possible to conditionally compile to .NET Framework version?

I can recall back when working with MFC you could support multiple versions of the MFC framework by checking the _MFC_VER macro. I'm doing some stuff now with .NET 4 and would like to use Tuple in a couple of spots but still keep everything else 3.5 compatible. I'm looking to do something like: #if DOTNET4 public Tuple<TSource, T...

Has Microsoft Fixed Linq to Entities Performance Problems in .NET 4.0?

I feel pretty comfortable with the entity framework now. I have been reading some performance articles on the Linq to Entities performance issues. Are these issues still present in .NET 4.0? ...

How do I use the Result from a CodeActivty<string> in WF 4.0?

I've created a custom activity in a .NET 4.0 beta 1 WF project. It's defined as: public class GetCurrentUserMailAddress : CodeActivity<string> because I've read that this is the most efficient way of returning a single result. At the end, I set the Result using: context.SetValue(Result, up.EmailAddress); But now I'm struggling ...

Is this expected C# 4.0 Tuple equality behavior?

I'm seeing different behavior between using .Equals and == between two of .NET 4.0's new Tuple<> instances. If I have overridden Equals on the object in the Tuple<> and call .Equals on the Tuples the override of Equals will be called. If I use == on the Tuples the override of Equals is not called. Is that by design and does it make sense...

Parse MP3 file in .NET v4.0

How can I parse an MP3 file to get its all attributes? Also how to edit and the attributes of the MP3 file? Is there any class available in .NET v4.0? ...

.NET Unhandled Exception Dialog not Appearing

I'm working on a .NET 4.0 Beta 1 application. When the app its run without a debugger attached and there an unhandled exception occurs, the application crashes without never showing the Unhandled Exception dialog (the one that showed the callstack and the exception that was thrown). I understand this behavior is desirable in production...

Code Contracts in .NET 4.0, no joy for non-nullable reference types fans?

I've been playing with Code Contracts on VS2008 (http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx). They surely are nice and provide a solid alternative to if-then-throw checks inside methods. Nonetheless I've been hoping that they could satisfy the need that I strongly feel for non-nullable reference types. Alas, from what I could...