.net-4.0

How can I do WCF Non-HTTP Activation with .Net 4 ?

Hi, I have a .Net 3.51 service which uses Non-HTTP Activation. This works fine. I want to convert it to .Net 4. In Windows 7, if you go to Control Panel, Add Remove Programs, Turn Windows Features on or off, there is a "Microsoft .NET Framework 3.5.1, WCF Non HTTP Activation" item. How would I do this for .Net 4 ? Mark ...

Loading a 3.5 compiled C++/CLI application in .NET 4.0

I'm trying to load a mixed managed application compiled and targeted for Framework 3.5 in the 4.0 CLR. We have a .config file next to the .exe where I've added this node: <?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0.21006" /> </startup> Unfortunately, the app crashes out on startup with a nasty...

Validation does not work when I use Validator.TryValidateObject.

DataAnnotations does not work with buddy class. The following code always validate true. Why ? var isValid = Validator.TryValidateObject(new Customer(), Context, results, true); and here is the buddy class. public partial class Customer { public string Name { get; set; } public int Age { get; set; } } [MetadataType(typeo...

Is it possible to pass an instance "pointer" to another process through a memory mapped file?

I'm basically searching for a way to pass instances across programs/processes without serializing the instances, in .NET 4.0. Yes, I'm missing my good ol' 100% unsafe pointers ;) I thought the new integration of Memory-mapped files to .NET 4.0 would help me, having read somewhere that you could pass references/pointers "natively" using...

Long running stateful service in .NET

Hi, I need to create a service in .NET that maintains (inner) state in-memory, spawns multiple threads and is generally long-running. There are a lot options - Good-old Windows Service Windows Communication Services Windows Workflow Foundation I really don't know which to choose. Most of the functionality is in a library used by t...

Using ASP.Net 4.0 for new Dev projects

I am currently in the early stages of developing a couple web applications, I have not written any code yet as I am still just gathering requirements and scoping things out. I want to target ASP.Net 4.0 winforms as the platform for these apps but I want to make sure there are no glaring issues with this new version before I commit. I un...

Can I run asp.net mvc 1 on .net 4?

I have a asp.net mvc site that references a couple of libraries. Recently I discovered that it is necessary to migrate those dlls to .net 4 (I mean compile them for .net 4). Can I run asp.net mvc 1 on .net 4. Migration to asp.net mvc 2 is postponed because of the removal of response.WriteSubstitution(...) method. ...

.NET 4.0 Implementing OutputCacheProvider

I am checking out the OutputCacheProvider in ASP.NET 4.0 and using it to store my output cache into the MongoDb database. I am not able to understand the purpose of Add method which is one of the override methods for OutputCacheProvider. The Add method is invoked when you have VaryByParam set to something. So, if I have VaryByParam = "id...

Making a WCF call with AJAX

Is it required to use a RESTful service to be able to make a ajax call to a wcf service (for example: by using WebInvoke attribute on Operation contracts) Once a service is made RESTful by adding a webHttp binding on the service host, can the host have other endpoints as well? (wsHttp or netTcp) Is it required that the aspNetCompatibili...

How can I copy an XmlNode from one XmlDocument to another?

I'm building a tool that authors/edits XML files, and I want to be able to populate it with template fragments defined in another XML file. For example, the tool has an "Add FooBarBaz Element" button that adds a element to the new document being created, and I want to add FooBarBaz by copying it from a template. Or let's say this is m...

Visual Studio 2010 RC with .net 4 beta 2

Does anyone know if it is possible to use Visual Studio 2010 RC with the beta 2 version of the .NET 4 framework? The reason I need to use the beta 2 version and not the RC is that there isn't an Expression Blend that can support the .NET 4 RC. I uninstalled the .NET 4 framework that installed with Visual Studio 2010, then I reinstalled ...

How to create a meaningful dynamic property?

The fictional example here. Suppose I designed a class named IODevice. This class already implements a structure that allows me to use it in the following way: IODevice dio = new IODevice(); try { dio.Pin["IsBirdInCageSensor"].Set(); dio.Pin["KillBird"].Get(); //dio.Pin["NonEx...

ninject .net 4.0

Can you use Ninject 2.0 with VS2010 RC1? ...

FileInfo..ctor(string fileName) throwing exception: bug in SL 4.0 or .NET 4.0?

The following test case passes in .NET 4.0: var fiT = new FileInfo("myhappyfilename"); Assert.IsNotNull(fiT); ... but fails in Silverlight 4.0 with the following error: System.ArgumentNullException: Value cannot be null. Parameter name: format at System.String.Format(IFormatProvider provider, String format, Object[] args) at Sy...

Is Lazy<T> supported in the compact framework?

Does anyone know if the new lazy initialization class (Lazy<T>) is or will be supported in the compact framework? I've looked on MSDN, but the support stuff listed on the bottom is kind of cryptic when it comes to support for the compact framework vs. the full-blown .Net framework. ...

.NET Framework 4 RTM on Windows server 2008 R2

I've just installed .NET 4 on Windows SErver 2008 R2 x64 and I am getting 500 Internal Server Error with an ASP.NET MVC application which was previously running fine on 3.5. The application was upgraded from targeting 3.5 to target 4 and I personally built it today on my development machine (changed in VS - Properties to .NET Framework 4...

Is NetNamedPipeBinding binding guaranteed to work only on the same machine?

Hi, I've created a Windows Service that uses WCF for communications to it. The service should be used be called only from the same machine. If I can guarantee that there's no way to communicate with it from another machine, I can consider it secured. Since I'm using communications on a single machine, I opted to used NetNamedPipeBindi...

What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?

I have a project in which I'd like to use some of the .NET 4.0 features but a core requirement is that I can use the System.Data.SQLite framework which is compiled against 2.X. I see mention of this being possible such as the accepted answer here but I don't see how to actually achieve this. When I just try and run my 4.0 project while ...

What is Microsoft.csharp.dll in .NET 4.0

This dll is added by default in Visual Studio 2010 projects. What is this new project used for. It does not seem to contain much after looking at it using Reflector and Google does not seem to have much to say about it either. ...

How can I add a VS 2010 .Net 4.0 build agent to TFS 2008

My company has two development teams using TFS 2008. My team would like to migrate our .Net 3.5 app to the .Net 4.0 framework, but the company is not ready to upgrade TFS to TFS 2010. Can we still use TFS 2008's team build system but with a Visual Studio 2010 solution/project structure that targets the .Net 4.0 framework? I am thinkin...