.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

Activity field xml serialization problem

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :JavaScript/VBScript

Hello,first of all I beg your pardon if my question could be out of topic, but I don't know where to address it. I'm working with 3.5 workflow foundation and I have a custom activity with a field of type DictionaryList, which is a serializable class containing some simple typed members, and a FeedbackItem[] member. FeedbackItem is a serializable class containing an ID (int), a Type (System.Type) and a Value (System.Object) fields. In the designer when I edit the custom activity, and I set the List Property (by using a PropertyGrid) i fill the DictionaryList class with all fields including the array of FeedbackItem. When I save the designer saves the workflow in a xoml file. When I load the xoml in the designer and I open the designer of the List property of the activity the DictionaryList object stored in previous session is missing the contrent of the FeedbackItem array; the FeedbackItems property has a FeedbackItem[0]. It seems like the xml serializer serializes the DictionaryList object but it can't deserialize it completely. Is there something I have to beware of? It's possible that some field in the FeedbackItem is not serializable and causes some error in deserialization process? I don't understand because il I edit the xoml file I can read the array like this:

    <x:Array Type="{x:Ty

View Complete Post

More Related Resource Links

Serialization and generics : problem with xmlinclude

Hello everyone. I've got a hierarchy of class like this: [Serializable] [xmlinclude(DiscreteDomain)] public abstract class Domain { } [Serializable] [xmlinclude(DiscreteDomain<>)] public abstract class DiscreteDomain : Domain { } [Serializable] public sealed class DiscreteDomain<T> : DiscreteDomain { } I can't serialize an object of type DiscreteDomain<T> because xmlinclude can't be used with a generics like DiscreteDomain<> (a type must be specified but i can't).   How can I serialize this type of object ?   Thx, JP

Customer Activity Designer Problem - "Could not generate view for VisualBasicValue`1"

I'm reading Bruce Bukovics Pro WF4 book and in chapter 16 - Advanced Customer Activites, he details emulating a Sequence activity along with a custom designer. When I drop the custom activity into a new xaml activity, I'm getting all sorts of wierdness. The custom sequence activity has a condition property that determines whether to schedule each child activity contained within. Once I set a value in the ExpressionTextBox for the activity, Visual Studio starts showing in red "Could not generate view for VisualBasicValue`1" along with this error showing up in my error window: The activity 'VisualBasicValue<Boolean>' cannot be referenced by activity 'MySequence' because the latter is not in another activity's implementation.  An activity can only be referenced by the implementation of an activity which specifies that activity as a child or import.  Activity 'VisualBasicValue<Boolean>' is declared by activity 'MySequence'. Here is the source for the activity itself: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Activities; using System.ComponentModel; using System.Collections.ObjectModel; namespace ActivityLibrary { [Designer(typeof(ActivityLibrary.Design.MySequenceDesigner))] public sealed class MySequence : NativeActivity { [Browsable(false)] public Collection<Activity&

Problem with CQWP "There is a problem with one or more of the field values below"

Hi, I'm trying out the content query webpart combined with content types. First I created a new site collection. In this site collection, these are the steps I did: - I enabled "SharePoint Server Publishing Infrastructure" feature at the site collection level - I enabled "SharePoint Server Publishing" feature at the site level - I created a new site column "Is Meat Eater", which is a yes/no field and added this to a new custom group called "Zoo" - I created a new content type called "Zoo Animal" that inherits from "Item" in category "List", and added this to a new custom group called "Zoo" - I added my site column "Is Meat Eater" to this content type (so now I have Title + Is Meat Eater) - I created a new custom list called "SharePoint Zoo" - I enabled content types on this list - I added "Zoo Animal" from the existing content types - I removed the default content type "Item" from the list (so now only 1 content type left, my own) - I added a few animals in the list - I added a content query web part on the homepage - As source I chose "Show items from all sites in this site collection" - As List Type I chose "custom list" - As Content Type Group I chose "Zoo" - As Content Type I chose "Zoo Animal" - I hit apply at

Problem when deployind ContentType: Error occurred in deployment step 'Activate Features': Field t

Im getting this error when i try to Deploy my ContenType: Error occurred in deployment step 'Activate Features': Field type GUID is not installed properly. Go to the list settings page to delete this field Does someone know how to fix this error? The ContentType is defined as: <     Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!--Site columns--> <Field Name="Test" DisplayName="Customer Subject ID" ID="{38A9E5BA-62FF-4F3B-90E3-F9961FEABE20}" Type="Text" Required="FALSE" /> <!--Parent ContentType: Item (0x01) --> <ContentType ID="0x01004317ec735b25468583d7470aa17c36ae" Name="NextContentTypes - NextCustomerContentType" Group="Next Content     Types"Description="NextCustomerContentType" Inherits="TRUE" Version="0"> <FieldRefs> <!-- References to field difinitions --> <FieldRef ID="{38A9E5BA-62FF-4F3B-90E3-F9961FEABE20}" Name="Test"></FieldRef> </FieldRefs> </ContentType> </     Elements>

Problem updating a boolean field

I have a button in a listview that updates a boolean field for the selected record. The button calls a method (ObsoleteOffice) in my BLL that sets the field (IsObsolete) to true...please see below for the code. However, the IsObsolete field never gets updated, nor does it throw an error.  In addition, the method works with string fields just fine, but nothing happens with the boolean field.  I would be grateful if anyone could shed some light on what I am doing wrong. Thanks.   //Method: ObsoleteOffice [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)] public bool ObsoleteOffice(int officeID, bool isObsolete) { offices.OfficesDataTable offices1 = Adapter.GetByOfficeID(officeID); if (offices1.Count == 0) // no matching record found, return false return false; offices.OfficesRow office = offices1[0]; // office.DateModified = DateTime.Now; office.IsObsolete = true; //Update the office record int rowsAffected = Adapter.Update(office); //Return true if exactly one row was updated, otherwise false return rowsAffected == 1; }  

Merge Replication and "Field size too large" problem

Hi,I have a single table database for tests configured on my server, I create another database using the same script that I use on my server on another server. I made a several inserts on the first database and I configure a merge replication between the two server and on the table article configure 2 integer columns to not be replicated and configure @pre_creation_cmd to none, because if I use another configuration on @pre_creation_cmd , when the snapshot applied it must recreated my table without the columns and I need then on another server. When I set @pre_creation_cmd  to none I need to create a rowguid column on the another server. My server is the Publisher and my another server is the publisher. I create the snapshot and when I sinconize the databases, the sinconization return that error:=================================================================================================The process could not bulk copy into table '"dbo"."CONSTS"'. (Source: MSSQL_REPL, Error number: MSSQL_REPL20037)Get help: http://help/MSSQL_REPL20037 Field size too large (Source: MSSQLServer, Error number: 0)Get help: http://help/0 To obtain an error file with details on the errors encountered when initializing the subscribing table, execute the bcp command that appears below.  Consult the BOL for more information on the bcp utility and its supported options. (Source:

Problem with bookmarks when combined with Delay activity.

Let's take this code sample : using System; using System.Activities; using System.Activities.DurableInstancing; using System.Activities.Statements; using System.Collections.Generic; using System.Runtime.DurableInstancing; using System.Threading; using System.Xml.Linq; using Microsoft.VisualBasic.Activities; namespace WindowsFormsApplication1 { public class WaitExternalEventActivityTestInnerCode : CodeActivity { public OutArgument<string> resultat { get; set; } protected override void Execute (CodeActivityContext context) { context.SetValue (resultat, "SUCCEEDED"); } } public class WaitExternalEventTestEvent : NativeActivity { protected override void Execute (NativeActivityContext context) { context.CreateBookmark ("TestEvent"); } protected override bool CanInduceIdle { get { return true; } } } internal static class Program { private static SqlWorkflowInstanceStore _store; private static readonly XName WorkflowHostTypePropertyName = XNamespace.Get ("urn:schemas-microsoft-com:System.Activities/4.0/properties").GetName ("WorkflowHostType"); private static readonly XName WfHostTypeName = XName.Get ("V1", "Test"); [STAThread] static void Main () { // Init the persistance store string connectionString = @"Data Source=.\

google map custom field type Rendering problem


Hi all,

I have rebuild the codeplex project of googlemapfield in visual studeio 2010 for sharepoint foundation 2010.It is able to show custom field when adding new column. I am unalbe to get  google map in display form.. I don't know where it went wrong. I am able to load a text pargaraph from control template file which is delcared in <div> as <p><cite>The Complete Manual of Typography</cite>, James Felici</p>. But not google map.

I have added safe control in web.config file and also enabled activex control scriptings in IE.

Here is my .ascx file code

<%@ Assembly Name="GoogleMapField64,Version=, Culture=neutral, PublicKeyToken=268a24657b14d504" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" 

Problem with serialization of objects

When I try to return a collection (an List<>) of a complex kind of object (each one have about 20-30 custom objects inside) I get this error:

Test method SMILTest.ServiceManagerTest.PessoasTest threw exception:  System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Security.SecuritySessionClientSettings`1+ClientSecurityDuplexSessionChannel[System.ServiceModel.Channels.IDuplexSessionChannel], cannot be used for communication because it is in the Faulted state..

Server stack trace:
   at System.ServiceModel.Channels.CommunicationObject.ThrowIfFaulted()
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecurityDuplexSessionChannel.TryReceive(TimeSpan timeout, Message& message)
   at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Obje

Problem with calculated field in SSRS

i have the foll scenario:
col1 col2 col3 col4 
A   1  100 
   2  250 150 
   3  500 250 
   4  600 100 
   5  900 300 

For col4 i need to calculate the difference b/w (the value in current row in col3 i.e. 250) - (the value in the previous row in col 3 i.e.100). i need to do that for all rows of col4. I need help with the expression to do this in SSRS.

XAML Serialization Problem


I try to save (serialize) a XAML document. The background is that the user of the application should be able to change the XAML document dynamically.

This works fine with some basic controls but as soon as I have a datagrid inside the XAML, non of this works:

System.Windows.Markup.XamlWriter.Save throws:

Cannot serialize a generic type 'System.Collections.ObjectModel.ObservableCollection`1[Microsoft.Windows.Controls.DataGridColumn]'.

System.Xaml.XamlServices.Save throws:

Constructor on type 'System.ComponentModel.ComponentConverter' not found.

I already found in forum that XAML does not fully support generics, however, is there a solution for this? I'm a bit confused because if XAML can be read dynamically it should also be possible to save it...

I use .NET Framework 4.

Thanks for reply... any suggestion is very welcome.

Serialization Problem....



i am trying this code but its giving me "There is an error in XML document (0, 0)."

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using System.IO;

namespace GridViewPaging
    public class Person
        private string _name;
        private CNIC _cnic;

        public string Name
                _name = value;
                return _name;

        public string NIC
                _cnic.NIC = value;
                return _cnic.NIC;


    public struct CNIC
        private string _cnic;
        private bool _isValid;

        public string NIC
                if (IsCNICValid(value))
                    _isValid = true;
                    _cnic = value;
                    _isValid = false;
                if (

Lookup field which allows multiple choice - problem when query with CAML


I created one simple list and added one column - lookup - I've chosen some source list and field, then marked "Allow multiple choice". I created new item in that list, by adding more than one valie to that coulm.

The problem is, when I use CAML query, that column has such values:


and it's suppose to be like this:


do You have any idea, why it doesn't query first ID?

Update Existing Sharepoint List's field Problem



This is about sharepoint sequential workflow using visual studio.

I ve a prob to updating existing sharepoint list's field on the basis of other field(id or somthing else), using visual studio.

I m updating sharepoint list but its adding a new row below at last in the sharepoint list.

i m having a UserID(lots of user's ID) field in the sharepoint list, on the basis of this userID i ve to update a perticular field corresponding to UserID.

Please tel me wat type of code i ve to mension.


Thanks in advance !

Regards- Sharad

Problem with [ID] in TITLE Field.


On my TITLE column, I have set the default field as: "SPF-FW2010-&[ID]" ... however the error is that the [ID] is not being pulled from the existing [ID] field (that is the unique number that auto-increment). How can I go about solving this?

My desire output should be example:





... and so on.

Thanks in advance.

Problem in properties.AfterProperties with respect to DateTime field.

Hi all,

I have an event handler, ItemAdding and I am trying to get start and end for "Calendar List".

For,  StartDate = Convert.ToDateTime(properties.AfterProperties["EventDate"]); its showing next day.
For e.g, User took 5 day vacation from 12 Jan to 16 Jan. But for StartDate its showing 13 Jan and also for end date i.e. 17th.

I tried some reserach on about this issue: 

But in my case, properties.ListItem is null.
SPListItem currentItem = properties.ListItem;
DateTime beforeValue = System.Convert.ToDateTime(currentItem.Fields[displayName].GetFieldValueForEdit(currentItem[displayName]));
properties.AfterProperties[internalFieldName] = SPUtility.CreateISO8601DateTimeFromSystemDateTime(beforeValue.AddDays(1)).ToString();

This is my complete code for ItemAdding










Msg 4866, Level 16, State 1, Line 1

The bulk load failed. The column is too long in the data file for row 1, column 34. Verify that the field terminator and row terminator are specified correctly.

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7330, Level 16, State 2, Line 1

Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".






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