Serialization loading problem with IE hosted control and custom class

  • Thread starter Thread starter Kristopher Wragg
  • Start date Start date
K

Kristopher Wragg

Hi,

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
http://testserver/dlls/DefaultCompany.PictureTest.DLL#DefaultCompany.PictureTest
Microsoft.IE.SecureFactory:
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. ---> System.IO.FileNotFoundException:
Could not load file or assembly 'CustomPictureBox, Version=1.0.0.5,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.

File name: 'CustomPictureBox, Version=1.0.0.5, Culture=neutral,
PublicKeyToken=null'
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
typeIndex)
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
ignoreCase)
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?

thanks

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
deserializing...
 
in the code the property thats causing the problem looks like this:

this.pictureBox1.ImageList = new CustomPictureBox.DynamicImage[] {
((CustomPictureBox.DynamicImage)(resources.GetObject("pictureBox1.ImageList"))),
((CustomPictureBox.DynamicImage)(resources.GetObject("pictureBox1.ImageList1")))};

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

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
directory?
 
Back
Top