473,379 Members | 1,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Error deserializing: The object with ID 31 implements the IObjectReference interface for which all dependencies cannot be resolved.

I am getting the following error when deserializing an object that has a couple of dozen dependant objects in its object graph. Anyone who can suggest where I might begin to look to resolve problem I would greatly in debted to. Serializing the object works fine. When I try to deserialize it, I get the following error:

A first chance exception of type 'System.Runtime.Serialization.SerializationExcepti on' occurred in mscorlib.dll
Additional information: The object with ID 31 implements the IObjectReference interface for which all dependencies cannot be resolved. The most likely cause is two instances of IObjectReference that have a mutual dependency on each other.

I am using the System.Runtime.Serialization.Formatters.Soap.SoapF ormatter and am getting the error when calling the Deserialize() method.

Some of my objects are quasi singletons (I will explain in a minute what I mean by this) and have sererialization serogates that implement IObjectReference. So I am presuming they are the culprit somehow. Removing them from the graph one by one for testing purposes would be an obvious tactic but very difficult and time consuming in this case because it would require some effort to get the code to even run in their absense. Therefore I am really hoping some one know what sorts of issues cause this error and can explain them or point me towads good documenation. MSDN does not mention this error.

What I mean by these objects being "quasi-singletons" is that they are more like enumerations. Rather that there being a single instance of the object, there are several, but the numer is fixed; each instance of the object reflects some immutable entity in our system and contains data about it. Below is a quick example of one of these objects. The code is trunkated for simplicity sake but the real McCoy is identical except for the number of instances it supports and the number of properties it contains.

If this is not the correct way to serialize this sort of object, I would be glad to know the correct method.

--Ken

using System;
using System.Runtime.Serialization;

namespace SWIFT.Configuration.Workflow
{
/// <summary>
/// This class represents the various types of object which the swift system is comprised of.
/// </summary>
/// <remarks>
/// There is only one intance of this class per each represented object type.
/// </remarks>
[Serializable]
public class ObjectType: ISerializable
{
private enum pObjectTypeEnum
{
Workspace,
Document,
Task,
User,
DataForm
}

public static readonly ObjectType Workspace = new ObjectType(pObjectTypeEnum.Workspace, "d37bdf57-8298-416e-b880-51892b78f63a", "Workspace");
public static readonly ObjectType Document = new ObjectType(pObjectTypeEnum.Document, "289ef8ef-f56b-4b01-92b4-0191b222ddc3", "Document");
public static readonly ObjectType Task = new ObjectType(pObjectTypeEnum.Task, "e06b7ce4-3d30-45e4-bf94-118046be851f", "Task");
public static readonly ObjectType User = new ObjectType(pObjectTypeEnum.User, "17aedaeb-dfcb-4cf3-a13b-d6f02195a81f", "User");
public static readonly ObjectType DataForm = new ObjectType(pObjectTypeEnum.DataForm, "ace70065-d136-402f-96f3-0606cded7754", "Data Form");

private static readonly System.Collections.Hashtable mcTypesByID = new System.Collections.Hashtable();

public readonly string SysKey;
public readonly string Name;

private readonly int miType;

private ObjectType(pObjectTypeEnum eType, string sKey, string sName)
{
SysKey = sKey;
Name = sName;
miType = (int)eType;

mcTypesByID.Add(miType, this);
}

public new void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("TypeID", miType);
info.SetType(typeof(ObjectType.ObjectTypeSerialize r));
}

internal ObjectType GetByType(int TypeID)
{
return (ObjectType)mcTypesByID[TypeID];
}

[Serializable]
private class ObjectTypeSerializer : IObjectReference, ISerializable
{
private readonly int miType;

private ObjectTypeSerializer(SerializationInfo info, StreamingContext context)
{
miType = info.GetInt32("TypeID");
}

//required as part of ISerializable
public void GetObjectData(SerializationInfo info, StreamingContext context) {}

public object GetRealObject(StreamingContext context)
{
return WFDataType.GetByType(miType);
}
}
}
}
Jul 21 '05 #1
0 2190

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Scott Auge | last post by:
I am looking for comments on something that lets me abstract database updates in an object. Lemme explain what I am thinking: Lets say I have an object Person with... SetFirstName()...
0
by: dean | last post by:
Hello Group: I obtained a copy ofthe python 2.3.3 depot (binary zipped) from the hp porting archive. I have successfully unzipped the file and installed it using swinstall. I received the...
0
by: Farek | last post by:
(If Im posting in the wrong place concerning COM+ and .NET plz redirect me.) Hello all, Im writing a COM+ in VB.NET that is suppose to be able to set/get an address(String value). I've made...
1
by: n_o_s_p_a__m | last post by:
My web service has a webmethod whose return type is declared as an interface type, for example: public IBusinessProcess GetBusinessProcess() {} which generates the lovely error: Cannot...
0
by: Kenneth Baltrinic | last post by:
I am getting the following error when deserializing an object that has a couple of dozen dependant objects in its object graph. Anyone who can suggest where I might begin to look to resolve...
7
by: wmkew | last post by:
Hello everyone I'm encountering a R6002 Runtime error and several bugs when trying to generate a simple Managed C++ application with .NET 2003. The main problem seems to arise from linking with...
11
by: Robin Tucker | last post by:
I have a COM object, which implements straightforwardly the IDataObject interface. It seems this isn't the same IDataObject interface we now have with .NET. Basically, the COM object implements...
14
by: Jeroen | last post by:
Hi all, I've got a question about writing a library. Let me characterize that library by the following: * there is a class A which is available to the user * there is a class B that is used...
0
by: shahiz | last post by:
This the error i get when i try to run my program Error: Unable to realize com.sun.media.amovie.AMController@18b81e3 Basically i have a mediapanel class that initialize and play the media as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.