Serialization loading problem with IE hosted control and custom class


Kristopher Wragg


I have controls that will hold a custom PictureBox I've been working
on, the picture box stores an array of a class I've made which contains
an Image a few integers and a string...

the controls seem to work if loaded up in Visual Studio, but when
hosted in Internet Explorer I get the following in my IEHost log and it
doesn't load the control:

Microsoft.IE.SecureFactory: Trying to create instance of type
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. ---> System.IO.FileNotFoundException:
Could not load file or assembly 'CustomPictureBox, Version=,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.

File name: 'CustomPictureBox, Version=, Culture=neutral,
at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark)
at System.RuntimeType.PrivateGetType(String typeName, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError)
at System.Resources.ResourceReader.FindType(Int32 typeIndex)
at System.Resources.ResourceReader.DeserializeObject(Int32
at System.Resources.ResourceReader.LoadObjectV2(Int32 pos,
ResourceTypeCode& typeCode)
at System.Resources.ResourceReader.LoadObject(Int32 pos,
ResourceTypeCode& typeCode)
at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean
ignoreCase, Boolean isString)
at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean
at System.Resources.ResourceManager.GetObject(String name,
CultureInfo culture, Boolean wrapUnmanagedMemStream)
at System.Resources.ResourceManager.GetObject(String name)
at DefaultCompany.PictureTest.InitializeComponent()
at DefaultCompany.PictureTest..ctor()

The only thing I can think of is that its trying to deserialize the
array property before the assembly is loaded and so it can't
deserialize due to the fact it doesn't know the type of the class or
its structure...

is this a fair assumption? any ideas on a fix to the problem?


Kris Wragg

Ps. currently its DynamicImage[] thats the property thats a problem,
I'm currently trying to get write a DynamicImageCollection that based
on CollectionBase, but that doesn't seem to save its items in the
Designer :( and I think this same problem will crop up anyway when



Kristopher Wragg

in the code the property thats causing the problem looks like this:

this.pictureBox1.ImageList = new CustomPictureBox.DynamicImage[] {

if this.pictureBox1.ImageList = null; ie I dont add any instances of
the class to the array then it will load fine... if I add any like what
is created above by the designer then it doesn't load

Kristopher Wragg

No reply's as yet, this issue is causing problems in other controls
too, serializable classes or components don't seem to work in IE, I
believe its due to it not loading the assembly in the right order or

anyone have any ideas? need to sort this issue ASAP


Is your CustomPictureBox class located in the same assembly
DefaultCompany.PictureTest.dll? If not, did you deploy it to the same


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question