.net-4.0

Why do my tests fail with System.Security.VerificationException?

I'm in the process of migrating one of my projects from VS2008 to VS2010. Now that I converted all of my projects in the solution to .NET 4.0 (Client Profile) when I run the test harness, almost all tests fail with the following exception: System.Security.VerificationException: Operation could destabilize the runtime. I've been...

WorkflowItemPresenter contents disappear on build

Ello all, In my custom activity, when I drop an activity into the WorkflowItemPresenter, save and compile, my activity suddenly disappears and I have no freakin clue why. I'm probably making some noob mistake somewhere but, I'm not seeing it. I've gone back and made sure my code complies fine and deleted and re-added my assembly contain...

Issue with configuration files in a multi project solution & dev/test/prod environment

When promoting from dev to test my client requires that I copy the exact installer that was used in dev to test. I can not recompile the application for change control purposes. My solution contains a number of projects including a Windows service and a data access class library. The Windows service project references the data access ...

How to apply a global style (allowing hightlighting after focus is lost) to a wpf treeview

I found the following code for showing the selected item in a treeview when focus has left, but I'm having trouble moving the code to App.xaml so any UserControl could use it. This does what I want <TreeView x:Name="trviewArchives" Width="141" Height="154" Canvas.Left="20" Canvas.Top="167" Background="{x:Null}" BorderBrush="#FF08182...

app.config changes are not recognized unless they are made from the Project Settings window in Visual Studio

I store my application settings in a project settings file. I notice that in addition to the Settings.settings file beneath the Properties folder in the Project, the settings are also stored in an app.config file. My application only recognizes changes to this file if I make changes via the Settings tab of the Project's Properties wind...

Forms Authentication adding additional information along with ReturnUrl

With Forms Authentication when the app needs to redirect to sign-in page is there an event or any extensibility point that will let me do additional work to the request before it redirects to the sign-in page? I would like to send additional information in the query string that could vary such that it wouldn't work to just statically em...

IGeoPositionWatcher<GeoPosition>.PositionChanged is not being fired, but GeoCoordinateWatcher.PositionChanged is.

Hi, I'm trying to write an application which monitors the location of the computer using the .net 4.0 System.Device.Location namespace. However I'm finding that the GeoCoordinateWatcher.PositionChanged event is only fired when I register with the event on the class, and not when I use the interface it implements. Here is a working ver...

Can I do this with LINQ?

Can I do either of these using LINQ: 1. Check that each element in an IEnumerable<string> has the correct extension. If not, throw exception. foreach(var filepath in filepaths) if(Path.GetExtension(filepath) != @".xml") throw new ArgumentException(...); 2. Take an IEnumerable<string> and serialise all of its elements...

Binding to a Guid on a DataView

Hello, first post here but I'm a frequent visitor =) I have a WPF application with .NET 4.0 and Visual Studio 2010 which uses DataViews (coming from an SQL Server 2008). I have two tables which looks like this Table1 GUID (Primary Key, UniqueIdentifier) Table2_GUID (UniqueIdentifier) Table2 GUID (Primary Key, UniqueIdentifier) ...

.net3.5 applications with .net framework 4

Hi, Can I run applications compiled with .net framework 3.5 on a computer with .net framework 4 installed (.net framework 3.5 is not installed)? Thanks ...

Linq GroupJoin with a Func<Inner,Outer,bool> ?

I have IEnumerable<A> and IEnumerable<B> I want to Group Join based on whether A.Test(B) returns true. The keyselector funcs do not seem to do this as the KeySelectors need to return keys of the same type so that they can be checked for equality. Is there something I'm missing here? ...

Is there a config type file for Visual Studio Add-In?

When creating a Visual Studio Add-In, how can you utilise an app.config for the add-in. If I add one to the project and deploy it then when the Add-In runs and I programmatically try to access it via the ConfigurationManager.AppSettings its not picking up the config file for the add-in. Am I doing something wrong or is there another mea...

Which object pool backing store to choose?

Hello, In our C# (.NET 4.0) application, we allocate and de-allocate a lot of memory, in different size chunks. We want to move to an object pool, to improve performance. We implemented an object pool already and saw some performance improvement. We're currently using a stack-based backing store. Other possible alternatives are, queue ...

Running application compiled with visual studio 2008 on .net 4 computer

Hi, I've compiled an application with vs 2008 and .net framework 3.5. I tried to run this application on computer with only .net framework 4 (.net framework 3.5 is not installed) and I've got an error (says that it can't load the assembly ....ServiceModel.... version 3.0). After installing .net framework 3.5 SP 1 it works. I have foun...

.NET 4 Content Based WCF Routing vs. .NET 3.5 Compact Framework

Hi all, I consider using .NET 4.0 Content Based WCF Routing. Currently I have a normal .NET 3.5 WCF Server. All Clients uses the compact framework .NET 3.5. Could there be a problem, if I will port my WCF Server to .NET 4.0? Thanks for your answer. Kind regards, pro ...

Getting strange System.Drawing.Bitmap cannot be located error

I have both VS 2008 and VS 2010 installed on my Win7 box. But for sometime I'm getting this strange error: Type System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a cannot be located. I'm not able to put any buttons on toolstrips or modify many other properties of normal controls (lik...

Problem sending UIElements via DependencyProperty in wpf

I have a usercontrol with a dependencyproperty that takes oen UIElement. So fare so good, the problem is I can not find the element's children. I think the problem is my lack of knowledge, could anyone tell me what the problem is and a possible solution? I have made a small test-program like this Usercontrol codebehinde: public UIEle...

Any issues with protobuf-net and .Net 4?

Protobuf-net's project page talks about all .Net versions apart from 4. Are there any issues with using protobuf-net under .Net 4? ...

How to use an embedded .NET exe in a C# library without rebuilding the file from its byte[]?

I have an embedded file - xsd.exe - in my .NET library. How can I, without rebuilding the embedded file from its byte[], use it? The exe runs on the command line so I need to be able to make calls like: xsd /o:.. or whatever. I have read something about ManifestResourceStream but I can't seem to find it in the framework and I have no...

.net 4.0 chart control custom grid line

Is it possible to customise how the grid lines appear. I have two charts one shows daily data - with Time as x axis. I would like grid-line to show on the hour or for example every 2 hours. In the second chart the x axis is across a date range so I would like grid-line to be for every day or for example every 5 days. ...