.net-4.0

Is there any way to load an assembly complied in VS2010 in VS2005?

We have a function in a VS2005 project that loads assembles and get type information from them . It does not instantiate these types though. We tried to load some assembles that are compiled in 2010, but keep getting the following exception. "Could not load file or assembly '2010ClassLibrary' or one of its dependencies. This assembly i...

.net 4 xslt transformation Extension Function broken

I'm in the process of upgrading an asp.net v3.5 web app. to v4 and I'm facing some problems with XSLT transformations I use on XmlDataSource objects. Part of a XSLT file: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:HttpUtility="ds:HttpUtility"> <xsl:output method="xml" indent="yes" encoding="u...

Update panel and script managar not working in .NET 4.0

I have converted my web application from 3.5 to 4.0. I have been getting the issue on update panel post back method. I have linkbutton and textboxes inside the same update panel, when clicking on linkbutton for fill the values system throw below JS error. Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6...

What new validation attributes do we have in .net-4?

What new validation attributes do we have in .net-4? ...

Linq to Entities 4.0 - Optimized Query and multiple calls to database in a single query

Hi, Can anyone tell me if the following query calls the database multiple times or just once? var bizItems = new { items = ( from bl in db.rc_BusinessLocations orderby bl.rc_BusinessProfiles.BusinessName select new BusinessLocationItem { BusinessLocation = bl, BusinessProfile ...

Using an optional parameter of type System.Drawing.Color

I am starting to take advantage of optional parameters in .Net 4.0 The problem I am having is when I try to declare an optional parameter of System.Drawing.Color: public myObject(int foo, string bar, Color rgb = Color.Transparent) { // .... } I want Color.Transparent to be the default value for the rgb param. The problem is, I k...

Profiling help in asp.net

I am building a site using WebFormsMvp and Entity Framework 4. The site is a bit slow and when i profile in dotTrace these three methods take 75% of the time. (My first method takes about 3%) System.Threading.WaitHandle.InternalWaitOne(SafeHandle, Int64, Boolean, Boolean) Microsoft.Samples.Runtime.Remoting.Channels.Pipe.PipeNative....

I'm getting Invalid expression term ":" error if I use <%:%> with VWD2010 Express

Hello, I'm getting Invalid expression term ":" error if I use <%:%> with VWD2010 Express, which I believe works with .NET4 framework. Only <%= %> or <% = Html.Encode()%> work. Is there any other configuration to apply or VWD2010 doesn't support that syntax? EDIT Here's a sample code I'm using <th><% : Html.LabelFor(x=>x.registrationD...

FieldAccessException when class accesses its own field (.NET project upgraded from 3.5 to 4.0)

I have a VB.NET solution, just upgraded from 3.5 to 4.0. One of the classes has a private field: Private _Projection As ICalculatedPath At runtime, any time the class containing that field accesses that field, I get a FieldAccessException. The first time that field happens to get accessed is a null check in a method, and one of the th...

ActionFilterAttribute equivalent in REST WCF .net 4.0

what is the ActionFilterAttribute equivalent in WCF? I have a rest service which looks like below [WebInvoke(Method = "POST", UriTemplate = "/")] public User CreateBookMark(BookMark bm) { User authenticateUser = GetUserSomeHow(); //do stuff } I want to change this to follwoing [WebInvoke(Method = "POST", UriTemplate = "/")] p...

.NET 4, WCF REST Services, Entity Framework, Serialization, and circular references

That title is quite a mouthful. Let me try to be as clear as I can... I have a WCF REST Service written in .NET 4 that uses the entity framework to pull some data from SQL Server into a list of objects. The objects are then returned as XML to the client. The problem is that the XML have references to each other due to my model's rela...

.NET 4 function : Function argument question

I'm following a tutorial on MVC on the .NET 4 framework. The tutorial created a function like this... using System.Web; using System.Web.Mvc; namespace vohministries.Helpers { public static class HtmlHelpers { public static string Truncate(this HtmlHelper helper, string input, int length) { if (inpu...

ContextMenu Will Not Stay Open C# .Net 4.0 Client Profile WinForms

Hi, I have been unable to figure out how to keep a context menu open after handling a click event past the first level. Here is an example of where I have a context menu with a menu of checkable menus. I open up the context menu after handling the click event, but I have to manually return to the inner menu. Is there a way to open up the...

How to remove a custom item from a listBox and ObservableCollection when click on a button

I have the listBox and a ObservableCollection. The listBox.ItemSource (listNotify.ItemSource) is set to that ObservableCollection (errosList). The problem that i have is that i don`t know how to remove the correct element from errorsList when the user click on the button with content x from listBox. For the item of the listBox i use a I...

How do I implement a static dictionary<T> with parameters at Runtime in C#?

I have the following code: public static class ScraperMasterUriDetails { public static Dictionary<Guid, string> MasterUriDetails; } However I've decided that I need to add an integer to the dictionary Dictionary<ScraperMasterUriDetails>, so I thought I'd add properties and a few parameters to the constructor. But,...

Closing console closes GUI app too

I'm using C#/WPF, and generated a console programmatically using the WinAPI's Alloc/FreeConsole. When this is done, the standard System.Console class interacts wih it fine. Except, when you close the console by clicking the X rather than using FreeConsole(), it closes the rest of the app too. I'm using .NET 4- how can I override this beh...

How do I handle malformed XML files during import process?

I just finished an app to import a fairly simple XML data file into a db. The app works fine but I'd like to know how I should handle a bad XML file. For example, the user selects an XML file that has a different layout than what is required for my app. Eventually, I'd also like to add the ability the select multiple files to be imported...

What WCF extensibility point should I use to implement custom security?

I'm trying to create a flexible security infrastructure for our WCF services on our intranet, but I'm not quite sure where I should be putting this code... there are so many different ways to extend WCF that I don't know for sure where to begin... The basic idea: every time my service is called - for any operation - I want some code to ...

How to keep reference between two projects when making a template in Visual Studio 2010

I have a solution with 3 projects and i have a reference between two of the projects and a reference to a .dll from a project in all 3 projects. The project are in Silverlight. I want to make a multi-project template and when i create a new project from that template the references doesn't work anymore. It make the modification to the na...

"Failed to request ThreadStore" - WinDbg debugging live process

I am debugging the live process (not dump) of PresentationHost.exe. It used to works fine, but suddenly few days ago I get the above error message. !Threads, !pe, virtually all SOS command doesn't work. All I remember is that I installed Visual Studio 2010 and .NET framework 4.0 before I'm getting that error. Is it related? UPDATE: I ...