.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

VS2010 Framework 4 Remoting with dataset with AllowDbNull=false gives TargetInvocationException

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :.NET Framework

I have an app that uses Remoting to send a DataSet, all working OK under Framework 3.5. When I upgraded to Framework 4.0 I find that if the DataSet contains a DataTable with a DataColumn that has AllowDbNull=false, then a TargetInvocationException is thrown. If I set the TargetFramework on the assembly that contains the dataset back to 3.5 it works fine. Or if I set AllowDbNull=true, it also works fine. In my test app, the dataset contains just 1 table, with 1 column, no datarows, no keys.

The stack trace is as follows:

Server stack trace: 

   at System.RuntimeMethodHandle._SerializationInvoke(IRuntimeMethodInfo method, Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)
   at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
   at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
   at System.Runtime.Serialization.ObjectManager.DoFixups()
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Bina

View Complete Post

More Related Resource Links

vs2010 web deployment project restarts w3svc even when restartwwwservice = false


We've updated some of our projects from VS2008 to VS2010.  When these projects are deployed the w3svc is restarted on the target machine, even when restartwwwservice = false in the vdproj file.


This was a problem in 2008 until SP1 (http://forums.asp.net/p/1300097/2534736.aspx).  Does this same problem exist in VS2010?


This is a major problem for us -  we need to be able to deploy projects without restarting IIS.


I've tried creating a new web deployment package and setting the restartWWWService field to false, but this still does a restart when it's installed.


Has anyone come across this problem in VS2010?

VS2010 seems to target wrong framework

I have a simple website which is fine if I target .Net 4, but if I select the target framework as 3.5, it seems to incorrectly target .Net 2.0? Switching back and forth between 3.5 and 4.0 targets actually results in the pages (via showing System.Environment.Version.ToString()), and the Dev Webserver itself (via double-clicking on the system tray icon), reporting 4.0 when targetted for 4.0, and 2.0 when targetted at 3.5. All versions of .Net are installed on my machines, and I have reproduced this on 2 separate machines, one with VS2010 Pro, and the other with Visual Web Developer 2010 Express. Is this a bug, or am I missing something? Thanks for any help Ade

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...


Unable to Target 2.0 Framework in VS2010


I have been using VS2005 for some time to build VB.NET applications using the 2.0 Framework.  I recently installed VS2010 on the same machine and am using it to build 4.0 Framework VB.NET applications.  All the apps work fine, and AddOrRemovePrograms shows Frameworks 1.1 through 4 installed, including the "Microsoft .NET Framework 4 Multi-Targeting Pack".  BUT, I am unable to use VS2010 to build applications to run on the 2.0 Framework, and (mis?) understand that should be do-able.  I opened an incident with MicrosoftConnect in August ("Framework Multi-Target Woes in VS2010") and sent off requested information twice, but have no response now for a month.  Any help/advice would be greatly appreciated.

Here is some detail:

The NewProject dialog only shows [.NET Framework 4].

If I try to open a 2005/2.0 project in 2010 it announces [The VB project "MyProject" is targeting ".NETFrameworkVersion=v2.0", which is not installed on this machine.  You must download this framework, as well as

VS2010 setup using Framework 2.0 failed


When I tried to deploy the project using DotNet 2.0 using VS2010, it failed and no error message. I make sure all the Framework checkboxes have 2.0 checked. In the prerequisies window, I only checked the installer 3.1. In the Detected Dependencies, The Microsoft .NET Framework is 2.0. The development and target PCs are both XP - SP3. When I unpack the .msi file in the target PC and run the application, it crashed.

The only way to make that work is to use VS2005 to perform the setup. Of course, copying the files over to the target PC directory works. So, the VS2010 setup is unpacking something at the target that makes it crash. VS2010 fixed the code-behind fatal bugs and I cannot go back to VS2005 or VS2008. 

I also noticed that you need to install 3.5 before you can use 2.0 in VS2010... Anybody knows what is going on ?


Why is the "System" Process opening and keeping the port open for my .NET remoting framework applica


I'm using Remoting in a .NET 3.5 framework application of mine (running on windows 2008 r2). I'm opening port 8086 with the following code

BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
      serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

      BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
      IDictionary props = new Hashtable();

        props["port"] = 8086
        TcpChannel channel = new TcpChannel(props, clientProv, serverProv);
        ChannelServices.RegisterChannel(channel, false);
          typeof(Remote), "Remote", WellKnownObjectMode.Singleton);
      catch (Exception ex)
        logger.Error("Failed to intialize service remoting: ", ex);

For some reason, when i restart my windows service that has the above code running, it throws an exception saying that "Only one usage of each socket address (protocol/network address/port) is normally permitted". Digging into this a little deaper it turns out that "System" process is holding on to my port and it won't let it go. Even if i kill my process, the "System" process still owns the port.


VS2010 Prof restart after new dataset and then dragging datatable


Dear all,

I am using VS2010 Prof on Windows XP SP3 on MySQL.

When I new item (DataSet), drag the DataTable.Then wizard prompt up for choosing connection and sql query. When I paste below SQL and then click OK, it restart. Do you know Why??? Anything that I am wrong???


FROM retail_transaction RT INNER JOIN trans_item_line TIL
WHERE RT.type_id <> 2
 AND ((RT.Start_DateTime >= ? AND RT.Start_DateTime <=?) OR 1=?)

Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Creating a Generic Entity Framework 4.0 Repository

With .NET 4.0 right around the corner, I thought it would be cool to download Visual Studio 2010 beta 2 and start playing around with the next release of Entity Framework.

The initial release of Entity Framework came with a great deal of criticism. To make matters worse, there was a large uproar when it was rumored that Microsoft would be abandoning LINQ to SQL, in favor of Entity Framework. This was because, at the time, many developers felt Entity Framework was an inferior technology to LINQ to SQL. To set things right, Microsoft proactively moved forward with improving Entity Framework, in time for the 4.0 release of the .NET Framework. This is good news because my initial impressions, so far, have been nothing but positive.

ASP.NET 4.0 Dynamic Data and Many to Many Entity Framework Entities

I did not play much with Dynamic Data controls in VS2008 and just made a cool discovery in VS2010 Beta 2. This may not even be new, but as I'm sitting 30,000+ feet over the Atlantic ocean, I don't have access to VS2008 at the moment to check.

Introducing ADO.NET and the Typed DataSet

In reviewing the applications it seemed everything they were doing involved database reads, writes, and manipulation. The development staff had been reviewing the articles and code samples for ADO.NET. They had spent many years refining their existing ADO based infrastructure and perfecting their use of ADO

Create and Use a Typed DataSet by Using Visual C# .NET

This article shows you how to create and use a typed DataSet in a small Web application. Typed DataSets, which inherit from the DataSet class, create first-class members of a DataSet's DataTables and DataColumns, yielding the many benefits that come with the use of strong typing.

Get Top 1 Record from Dataset

Many of them in need of getting the Top 1 or Top 10 records from a Dataset without going to SQL query. It is possible to do from Code Behind. I have given the code below,
The below code is to get single record from a Dataset. Also I have given for getting 8 records at Green Color.

Returning a DataSet From a Web Services: Step-by-Step

This Example Shows how to create a webservice which returns a DataSet and a Client Which displays the DataSet in a Grid.


This Example Shows how to create a webservice which returns a DataSet and a Client Which displays the DataSet in a Grid.

Entity Framework 4 Tips for WinForms Development

I've been recently working on a smart client (WinForms) application backed by Entitiy Framework 4 (EF4) on Visual Studio 2010. In this blog post I will try to give you some tips regarding some limitations and points to be careful about EF4.

Bar Code Scanners with the .NET Compact Framework

Summary: Learn how to make your applications use bar code scanners in a generic way-ndependent of the specific bar code scanners that are used on different devices. Using the design patterns Façade and Factory, the implementation not only supports multiple bar code scanners, but it also makes it easy to add support for other bar code scanners. After a brief discussion about bar code scanners and the bar code scanner pattern, a download code sample, written in C#, demonstrates the use of the pattern and technologies.

Serial Communication with the .NET Compact Framework

Learn how to make your applications communicate over a serial port and how to handle common issues when implementing serial solutions. After a general discussion about serial communication and a common serial communication standard, this article demonstrates a practical use of the technologies through sample source code written in C#.
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