473,404 Members | 2,114 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,404 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 2194

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...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.