System.TypeLoadException
Thanks for any help.
Lance
Thanks for any help.
Lance
Thank you for the idea, but what I discovered is that the issue arrises when a generic class is defined in one project and then used in another project. Here is a sample:
' ********************************
' Put this code in Project1 (i.e., NOT the project that contains the main form.
' ********************************
Public Class Class1(Of T)
Public Overridable Function GetIt() As T
End Function
Public Overridable Sub SetIt(ByVal item As T)
End Sub
Public Overridable Sub ShowIt()
End Sub
End Class
Public Class Class2(Of T)
Inherits Class1(Of T)
End Class
' ********************************
' Put this code in Project2 (i.e., the project that contains the main form.
' ********************************
Public Class Class3(Of T)
Inherits Project1.Class2(Of T)
Public Overrides Function GetIt() As T
End Function
Public Overrides Sub SetIt(ByVal item As T)
End Sub
Public Overrides Sub ShowIt()
End Sub
End Class
Public Class Form1
Sub New()
MyBase.New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Dim x As New Class3(Of Object)
End Sub
End Class
Note that the exception does not occur if Class3 inherits from Project1.Class1 or if Class3 does not contain any overrides. Also note that any one of the overrides in Class3 will cause the exception to occur.
Please do not hesitate to let me know if you have any questions.
Thanks,
Lance