.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

multi targeting in VS2010: .NET 4 vs 2/3.5 serialization issue

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :.NET Framework

in our team, we develop a  client/server application where the data (custom poco classes) get serialized and compressed and sent via WCF between server and client.
The data objects are always put in our custom IList<T> before beeing serialized (BinaryFormatter). Tthus, the list itself is going to be serialized/deserialized.
We have actually 2 implementations of IList<T>:
a)'PocoList<T>' which implements IListSource and IList<T>. The serialization is done in this class.
b)'PocoBindingList<T>' which implements IBindingList, IList and IList<T>. The main idea is to bind this list with the controls in the client.
So all pocos and these lists are implemented in a 'common' project shared by both solutions.

As long as we were using .NET 3.5 in server and 2.0 in client, it went fine.
Yesterday, we upgraded the Server projects from .NET 3.5 to .NET 4. The client solution is still targeted to .NET 2.0. We are working in VS2010 in both solutions.

Now I get in client the following exception which occurs in the Deserialize method of the BinaryFormatter:
 var serializer = new BinaryFormatter();
 object deserializedObject = serializer.Deserialize(dataStream);

Exception has been thrown by the target of an invocation.


View Complete Post

More Related Resource Links

Opening vs2008 solution file in vs2010 - Framework targeting issue


Hey guys,

I am opening a vs2008 .sln file inside vs2010 - the conversion wizard shows up, and it goes through with no errors other than a pop up warning me that this solution needs .Net Framework 3.5 and that it is "not installed on this machine" - I chose to target it to .Net Framework 4.0 and to try to switch it later as an option.

I then bring up Properties - >Application -> Target Framework and in the dropdown, .Net Framework 3.5 is not listed - which is strange since in "Add or Remove Programs" I can see .Net Framework 3.5 is installed on my machine.

How can I get Framework 3.5 to show up in the dropdown so I can target this project to that framework?

Can't say I've ever done this, so I'm pretty sure I'm doing something wrong.


Update: I tried Method #1 here (http://blogs.msdn.com/b/robvi/archive/2004/02/17/75272.aspx) and I cannot see v3.5 - so where did it go? I'm confused why it is not in my registry but shows up in "Add or Remove Programs" list...


Basic Instincts: Multi-Targeting Visual Basic Applications in Visual Studio 2010


Visual Studio 2010 lets you create applications that target versions of the Microsoft .NET Framework from 2.0 to 4, and each step in between. We take a look at how multi-targeting works in Visual Studio today, and explain how you should approach multi-targeting in your projects.

Spotty Bowles

MSDN Magazine June 2010

VS2010 Schema Compare Issue

I’m using VS2010 Schema Compare to compare two databases – let’s call them ‘DB1’ and ‘DB2’. I want DB1 to have its schema altered to match DB2. I select DB2 as the source and DB1 as the target, and compare. When I hit the Write Updates button, I am getting the following error: SQL01268: .Net SqlClient Data Provider: Msg 1834, Level 16, State 1, Line 1 The file ‘c:Program FilesMicrosoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\DB1.mdf’ cannot be overwritten. It is being used by database ‘DB1’. Why is Schema Compare trying to create a new DB? And, more to the point, why is it trying to create a DB named the same as the Source? Can anyone give me a workarround here? Thanks in advance.

Issue with multi-valued crawled property

Hi, The problem is, we have a multi-valued crawled property (Managed Metadata type) which we are mapping to a managed property. The managed property has been created, setting MergeCrawledProperties to false.   On the page http://technet.microsoft.com/en-us/library/ff393811.aspx , it states that if MergeCrawledProperties is not set, only the first element is stored in the managed property. We are seeing this behaviour in our environment.   That is causing an issue with refinement results based on this managed property, because it is not including the second element as a result. For example, if we crawl the following content:   Doc1.doc           Property1;Property2 Doc2.doc           Property1;Property2 Doc3.doc           Property2   Refinement results look like this: Property 1           RefinementCount = 2 Property 2           RefinementCount = 1   Ideally we would like to see Property 2’s RefinementCount = 3 to accurately reflect our source data.   We also tried setting MergeCrawledProperties to true , however this merges results together.   For example, with our scenario above, refi

Namespace resolution issue when loading activities designed in VS2010 in rehosted WorkflowDesigner

Hi. I have activities that is made in VS2010, that are to be used in a rehosted WorkflowDesigner app. In the rehosted app I have a WorkflowDesigner, a toolbox with all the standard and my custom activities, and a property window. The problem occures when I load a composite activity that has reference to other custom activities (and that is drawn in the designer in VS2010). In the rehosted app the composite activity is shown almost as expected, except that all the referenced activities are shown in the designer as a red error message: "Activity could not be loaded because of errors in the XAML."  If I load the same activity in VS2010 it works.  If I remove the referenced activity in the rehosted app and adds it from the toolbox there, it works. If I draw the composite activity in the rehosted app from "the ground up", it works. If I compare the activity XAML that is saved in VS2010, and the activity XAML when opened, modified and saved in the rehosted app, I find differences in how namespaces are expressed: The Activity-XAML from VS2010 has namespace resolution at the top: xmlns:local="clr-namespace:WCFWorkflowPOC" The Activity-XAML from the rehosted app does not save namespace resolution at the top. If I add the activity in the rehosted app insted of in VS2010, it places namespace resolution

Multi Tenant - User Profile Sync Issue




I ahve the user profile setup in partition mode. Every thin appears to be installed fine and running. On the main central admin page it list mulitple tenants. I have to seperate subscriptions setup with the following commands

Add-SPSiteSubscriptionProfileConfig -Identity $sub1 -ProfileServiceApplicationProxy $pUPSP -SynchronizationOU $ou -mysitehostlocation $mysiteurl

The subscription also has a featurepack and userauthenticationpath set


I recive the foloing erro when the MOS FIM connector tryes to export any user profiles

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Specified cast is not valid.
   at Microsoft.Office.Server.UserProfiles.ProfileChangeData.GetPartitionId(UserProfileApplicationProxy upaProxy)
   at Microsoft.Office.Server.UserProfiles.ProfileImportExportService.UpdateWithProfileChangeData(Int64 importExportId, ProfileChangeData[] profileChangeData)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,

Weird serialization DataContract issue




I am having very weird issue where values submitted by WCF client are not serialized. I have tested the DataContracts by using DataContractSerializer to serialize and deserialize Object to/from xml file and there are no issues.


Due to the commercial nature of the project I am unable to post the actual code but following illustrates the structure:


public class Person
  private string name;

  public string Name { get { return name; } set { name = value; }}

  private Place location;

  public Place Location { get { return location; } set { location = value; }}

public class Friend : Person

menuitem blend to vs2010 issue


hi all,

i using blend 4 to customize the default template for menuitem that i want to use for my application.
Now, i complete this task: i choose to edit the current menuitem template in blend, this generate the relative xaml code and i save, i load the ui in VS2010 designer the menuitems as been all expanded. I do not touch width property. Why? This is trouble a lot...


Roberto Pallucchini
*** Please mark as Answer, if this reply helps you***
*** Per favore Suggerisci come risposta, se la risposta ti è stata di aiuto***

menuitem blend to vs2010 issue


hi all,

i using blend 4 to customize the default template for menuitem that i want to use for my application.
Now, i complete this task: i choose to edit the current menuitem template in blend, this generate the relative xaml code and i save, i load the ui in VS2010 designer the menuitems as been all expanded. I do not touch width property. Why? This is trouble a lot...


Roberto Pallucchini
*** Please mark as Answer, if this reply helps you***
*** Per favore Suggerisci come risposta, se la risposta ti è stata di aiuto***

Issue with SSRS multi-parameter control


Hi Folks,

I am having the attached error with a multi-parameter filter control. This is happening only when there is just 1 value in the list.

Has anyone come across this issue and is there a solution to this? I am using SSRS 2005.

Sorry was trying to attached a snap-shot here but don't know if thats possible.

I'll try yo put the issue in words. The list box does not show the item in it. It does not render fully.



Issue with multi valued parameters in SSRS using Oracle data source


Hi All,

I have a dataset which is getting data from oracle datasource and my Dataset query expression is

="select To_Char(Time_Stamp,'Month') as Month, Node_Name as Device,Connection,MSNAME,Monitor,Avg as Average,Max as Maximum FROM OracleDataVW where ((monitor='X' and msname in ('Y')) or (MONITOR = 'CPU Utilization' AND MSNAME = 'utilization')) and TO_Char(Time_Stamp,'Mon YYYY') in  ('"+ Join(Parameters!Parameter1.Value,",") +"')"

My parameter is multiValued parameter. The above query is working good if i select one value,however if select more than one value or all it is not giving me the data. I tried to put Ltrim and Rtrim in Join but it is giving me another syntax error.

Please help me with this

multi-language issue in mvc - soliving with routes / need a constraint !!


hi guys,

I am creating a multi language website with asp.net mvc 2.0

I tried to solve the problem with routes and I guess it will work just fine but I need some constraint inside my route;

here is my routes;

I have two routes;

                    new { controller = "Blogs", action = "Index" },
                    new { Id = @"\d+" }

                "Default", // Route name
                "{language}/{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", language = "tr", id = UrlParameter.Optional } // Parameter defaults

in 1st route, I do not need the language so it will pass without language. I am only excepting integer on this route as you could see on the id constraint.

what I need is that;

  • in the 2nd route, I need a constraint that specify language variable only can be en or tr. how can I write that?

thanks !

Binary Serialization versioning issue


I have a binary serialization versioning issue that I haven't been able to figure out. Say I start out with the following ( call this V1 )

 interface IFoo
  void Test();

 class Foo : IFoo
  string data = "something";
  Bar bar;
  public Foo() { bar = new Bar(this); }
  public void Test() { Console.WriteLine("Foo {0}", data); }

 class Bar
  IFoo foo;
  public Bar(IFoo foo) { this.foo = foo; }

and then later I add another class ( call this version V2 )


.Net Remoting multi threading issue



I have a Windows service running on the server. It allows client workstations access it via .Net remoting. The Server service is simply a gateway to the database. Clients call methods on the Server class via remoting to make database calls (Selects, Inserts etc.).

During load testing we've observed the calls to the server take longer when multiple clients make simultaneous requests. The analysis indicates the requests are actually getting queued up. If 2 clients call the same method on the Server object, the two requests are processed in sequence. We have tried both Singleton and Singlecall. Same results.

Is there a bug in .Net remoting that it cannot process simultaneous client requests? If yes, is there a workaround (a quick one)?

We are using .Net 2.0 and are willing to switch to a higher version if the bug has been resolved in 3.0 or 4.0.



Issue with BCS Model deployment in VS2010


I'm seeing an issue with deploying a BCS model project created using VS2010

I updated the model and added additional properties to LOB System Instance and redeployed and the new properties added are not showing in application definition file deployed to BCS, I exported the model file from BCS directly and confirmed this, none of the new properties I added in VS2010 were there. Anyone else seen this? I also looked at the model file that was packaged into wsp and I was able to see the new properties that I added, definitely looks like some bug during deployment

I had to go into manage service applications->Business Connectivity Service and cleanup all references and redeploy bdcmodel from VS2010



Microsoft Certified Master | SharePoint 2007

Multi-threading in .NET: Introduction and suggestions

This article uses the C# type shorthands throughout - int for Int32 etc. I hope this makes it easier for C# developers to read, and won't impede any other developers too much. It also only talks about the C# ways of declaring variables to be volatile and locking monitors. Developers using other languages can find the equivalents in their own preferred environment, I'm sure.

Multi File Upload Using JQuery!

Everyone knows about the file upload in .NET. But the multi file upload is some what difficult in .NET. For that purpose we can have some AJAX or JQuery!. Jquery is the latest advanced version. It will give some animated upload. You can try it for your own!!!!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend