Jeffrey,
Thanks for your message. I've interleaved my replies.
I am not sure if you used the CodeDOM serialization correct, and if CodeDOM serialization is the correct solution for serializing your objects.
I need the state of the component to be serialized into its source code, and for reasons that would be too complicated to go into
here, the InstanceDescriptor approach won't work (put simply, the internal state of the component is too involved to fit that
model).
It's important to keep in mind that the CodeDOM implementation I am using was working fine. The only change I made was to a support
assembly used by the project (which actually has nothing to do with the code serialization). So there's some kind of unintended
consequence, or parallel bug, occuring.
I assume you see these error messages in the VS.net2003 designer surface.
Not quite. They appear in the Task List window below the design surface as "Build Errors". I'm familiar with the kind of exceptions
you're talking about (e.g., failure to secure a valid license). This problem is a little different -- the custom design surface
appears, and some of the state information is correctly displayed, but much of the state information doesn't appear. For example,
this line is involved with the failure to convert Type (I say this because commenting out the line in the component's
InitializeComponent() method makes that particular build error go away):
this.AccessControl = new OlbertMcHughLLC.DBFramework.Security.AccessControl("acl", "idnum", "name", "acl_detail", "acl_id", "name",
"can_read", "can_write", "can_add", "can_delete");
What confuses me about this supposed Type conversion error is that the AccessControl property is >>defined as<<
OlbertMcHughLLC.DBFramework.Security.AccessControl (I tried making that definition explicit -- i.e., by not relying on the using
statement, just in case I had a name collision -- but that didn't solve the problem). How an instance of a Type cannot have the same
Type is confusing. But I've run into that problem before, when an assembly is loaded both dynamically and statically. The Framework
considers the two assemblies to be different, even though they're not. Is there a tool I can use to see if assemblies are being
loaded both dynamically and statically? I don't know why that would suddenly crop up in a working build, but at this point I'll try
anything.
This is an example of a statement in InitializeComponent() which causes the method not found error:
this.TableList.Add(new TableInfo("appeal", "Appeals", "records information on which Donot Groups were solicited in which
fund-raising appeals", "", "appeal_desc", "appeal_desc", "OlbertMcHughLLC.SolDon.SCEFRowCalculator,SolDonBrowser",
"CalculateAppeal", new DataField[] {
new LookupField("giver_id", "giver", "Donor Group ID", "", false, false, false, false, true),
new LookupField("campaign_id", "campaign", "Campaign ID", "", false, false, false, false, true),
new LookupField("year_id", "year", "Year ID", "", false, false, false, false, true),
new LookupField("user_id", "user", "User ID Number", "", false, false, false, true, true),
new DataField("appeal_date", typeof(System.DateTime), "Date Appeal Made", "", false, false, false, false, false, false,
true),
new TextField("notes", "Notes", "", false, false, false, false, false, true, 1073741823, true),
new CalculatedField("appeal_desc", typeof(string), "appeal_desc", "", false, false, false)}));
I don't expect this to make a lot of sense to you out of context, but the key point is this: the TableInfo object being added to the
TableList collection is of the same Type as the TableList collection is defined to contain (it's a strongly-typed collection). I'm
guessing that the reason the method can't be found is because, again, the Type of the TableInfo object being created is subtly
different, so far as the Framework is concerned, from the Type the collection is designed to contain. Again, this leads me back to
that static/dynamic assembly loading silliness.
When the exception throws out, in the debugger call stack window, we can get the list of exception call stack.
(You have to setup the symbol correctly)
I am familiar with that technique of using one instance of VS2003 to debug another. In fact, I cannot imagine how one could develop
things like custom control designers without it
.
Good point about dumping the exception call stack. I should've included that in the original post. Here is the dump for the failure
to convert Type:
mscorlib.dll!System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Object obj =
{OlbertMcHughLLC.DBFramework.OfflineQuery.OfflineSqlDataPackage}, System.Reflection.BindingFlags invokeAttr = Default,
System.Reflection.Binder binder = <undefined value>, System.Object[] parameters = {Length=1}, System.Globalization.CultureInfo
culture = <undefined value>, bool verifyAccess = true) + 0x232 bytes
mscorlib.dll!System.Reflection.RuntimeMethodInfo.Invoke(System.Object obj =
{OlbertMcHughLLC.DBFramework.OfflineQuery.OfflineSqlDataPackage}, System.Reflection.BindingFlags invokeAttr = Default,
System.Reflection.Binder binder = <undefined value>, System.Object[] parameters = {Length=1}, System.Globalization.CultureInfo
culture = <undefined value>) + 0x23 bytes
mscorlib.dll!System.Reflection.MethodBase.Invoke(System.Object obj =
{OlbertMcHughLLC.DBFramework.OfflineQuery.OfflineSqlDataPackage}, System.Object[] parameters = {Length=1}) + 0x1d bytes
mscorlib.dll!System.Reflection.MethodInfo.Invoke(System.Object obj =
{OlbertMcHughLLC.DBFramework.OfflineQuery.OfflineSqlDataPackage}, System.Object[] parameters = {Length=1}) + 0x15 bytes
system.dll!System.ComponentModel.ReflectPropertyDescriptor.SetValue(System.Object component =
{OlbertMcHughLLC.DBFramework.OfflineQuery.OfflineSqlDataPackage}, System.Object value =
{OlbertMcHughLLC.DBFramework.Security.AccessControl}) + 0x189 bytes
system.design.dll!System.ComponentModel.Design.InheritedPropertyDescriptor.SetValue(System.Object component =
{OlbertMcHughLLC.DBFramework.OfflineQuery.OfflineSqlDataPackage}, System.Object value =
{OlbertMcHughLLC.DBFramework.Security.AccessControl}) + 0x1a bytes
system.design.dll!System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeAssignStatement(System.ComponentModel.Design.Serialization.IDesignerSerializationManager
manager = {Microsoft.VisualStudio.Designer.Serialization.VSDesignerLoader.VsCodeDomLoader}, System.CodeDom.CodeAssignStatement
statement = {System.CodeDom.CodeAssignStatement}) + 0x797 bytes
system.design.dll!System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatement(System.ComponentModel.Design.Serialization.IDesignerSerializationManager
manager = {Microsoft.VisualStudio.Designer.Serialization.VSDesignerLoader.VsCodeDomLoader}, System.CodeDom.CodeStatement statement =
{System.CodeDom.CodeAssignStatement}) + 0x74 bytes
system.design.dll!System.ComponentModel.Design.Serialization.RootCodeDomSerializer.Deserialize(System.ComponentModel.Design.Serialization.IDesignerSerializationManager
manager = {Microsoft.VisualStudio.Designer.Serialization.VSDesignerLoader.VsCodeDomLoader}, System.Object codeObject =
{System.CodeDom.CodeTypeDeclaration}) + 0x12e5 bytes
microsoft.visualstudio.dll!Microsoft.VisualStudio.Designer.Serialization.CodeDomLoader.Load() + 0x235 bytes
microsoft.visualstudio.dll!Microsoft.VisualStudio.Designer.Serialization.BaseDesignerLoader.Load() + 0x98 bytes
microsoft.visualstudio.dll!Microsoft.VisualStudio.Designer.Serialization.BaseDesignerLoader.OnTextBufferLoaded(System.Object
sender = {Microsoft.VisualStudio.Designer.Shell.ShellTextBuffer}, System.EventArgs e = {...}) + 0x42 bytes
microsoft.visualstudio.dll!Microsoft.VisualStudio.Designer.Shell.ShellTextBuffer.Microsoft.VisualStudio.Interop.IVsTextBufferDataEvents.OnLoadCompleted(bool
fReload = false) + 0x78 bytes
Here is the exception trace for the failure to find a method:
mscorlib.dll!System.DefaultBinder.BindToMethod(System.Reflection.BindingFlags bindingAttr = 276,
System.Reflection.MethodBase[] match = {Length=1}, System.Object[] args = {Length=1}, System.Reflection.ParameterModifier[]
modifiers = <undefined value>, System.Globalization.CultureInfo cultureInfo = <undefined value>, string[] names = <undefined value>,
System.Object state = <undefined value>) + 0xee2 bytes
system.design.dll!System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeExpression(System.ComponentModel.Design.Serialization.IDesignerSerializationManager
manager = {Microsoft.VisualStudio.Designer.Serialization.VSDesignerLoader.VsCodeDomLoader}, string name = null,
System.CodeDom.CodeExpression expression = {System.CodeDom.CodeMethodInvokeExpression}) + 0x1bb3 bytes
system.design.dll!System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatement(System.ComponentModel.Design.Serialization.IDesignerSerializationManager
manager = {Microsoft.VisualStudio.Designer.Serialization.VSDesignerLoader.VsCodeDomLoader}, System.CodeDom.CodeStatement statement =
{System.CodeDom.CodeExpressionStatement}) + 0x12f bytes
system.design.dll!System.ComponentModel.Design.Serialization.RootCodeDomSerializer.Deserialize(System.ComponentModel.Design.Serialization.IDesignerSerializationManager
manager = {Microsoft.VisualStudio.Designer.Serialization.VSDesignerLoader.VsCodeDomLoader}, System.Object codeObject =
{System.CodeDom.CodeTypeDeclaration}) + 0x12e5 bytes
microsoft.visualstudio.dll!Microsoft.VisualStudio.Designer.Serialization.CodeDomLoader.Load() + 0x235 bytes
microsoft.visualstudio.dll!Microsoft.VisualStudio.Designer.Serialization.BaseDesignerLoader.Load() + 0x98 bytes
microsoft.visualstudio.dll!Microsoft.VisualStudio.Designer.Serialization.BaseDesignerLoader.OnTextBufferLoaded(System.Object
sender = {Microsoft.VisualStudio.Designer.Shell.ShellTextBuffer}, System.EventArgs e = {...}) + 0x42 bytes
microsoft.visualstudio.dll!Microsoft.VisualStudio.Designer.Shell.ShellTextBuffer.Microsoft.VisualStudio.Interop.IVsTextBufferDataEvents.OnLoadCompleted(bool
fReload = false) + 0x78 bytes
For more information, please refer to the article below:
"Debugging Design-Time Controls"
http://msdn.microsoft.com/library/d...en-us/dnwinforms/html/designtimedebugging.asp
I'll take a look at the article.
- Mark