HighTechTalks DotNet Forums  

Usercontrol bug when exposing a class derived from a generic list

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss Usercontrol bug when exposing a class derived from a generic list in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
chrisfost@gmail.com
 
Posts: n/a

Default Usercontrol bug when exposing a class derived from a generic list - 11-28-2006 , 10:02 AM






This bug can be replicated by doing the following:

1) Create a new smart device application in visual studio 2005
2) Replace class1.cs with code below
3) Add a new user control
4) Replace usercontrol1.cs with code below
5) Build application
6) The error shown below occurs when attempting to drop the control on
a Form

It occurs when exposing a class from a usercontrol which inherits from
a generic list. I can workaround this problem by either changing the
code the property definition in the usercontrol to return a
List<Class2> or OuterClass2. This behaves as expected when creating a
Windows application using the full framework.


---------------------------- Class1.cs -------------------------------

using System.Collections.Generic;

namespace DeviceApplication1
{
public class OuterClass2
{
public Class1 Class2;
}

public class Class1 : List<Class2>
{

}

public class Class2
{

}
}

---------------------- Usercontrol1.cs ---------------------------

using System.Windows.Forms;

namespace DeviceApplication1
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}

public Class2 Test
{
get { return null; }
set { }
}
}
}


-------------Error-----------------------

Failed to create component 'UserControl1'. The error message follows:

'System.IO.FileLoadException: The given assembly name or codebase was
invalid. (Exception from HRESULT: 0x80131047)

at System.Reflection.AssemblyName.nInit(Assembly& assembly, Boolean
forIntrospection, Boolean raiseResolveEvent)

at System.Reflection.AssemblyName.nInit()

at System.Reflection.AssemblyName..ctor(String assemblyName)

at
Microsoft.CompactFramework.Design.DeviceTypeResolu tionService.GetDeviceType(String
typeName, Boolean throwOnError, Boolean ignoreCase)

at
Microsoft.CompactFramework.Design.DeviceTypeResolu tionService.GetDeviceType(Type
type, Boolean throwOnError, Boolean ignoreCase)

at
Microsoft.CompactFramework.Build.MetadataService.G etTypeAttributes(Type
desktopType)

at
Microsoft.CompactFramework.Design.DeviceCustomType Descriptor.CreateDeviceMetaProperty(PropertyDescri ptor
desktopProperty)

at
Microsoft.CompactFramework.Design.DeviceCustomType Descriptor.GetProperties(Attribute[]
attributes)

at
Microsoft.CompactFramework.Design.DeviceCustomType Descriptor.GetPr...'


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.