Bug 1360 - Converting Object to BindingList(Of T) fails in VB.NET
Summary: Converting Object to BindingList(Of T) fails in VB.NET
Status: RESOLVED UPSTREAM
Alias: None
Product: Compilers
Classification: Mono
Component: VisualBasic ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2011-10-08 06:15 UTC by JCD
Modified: 2018-05-22 12:01 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED UPSTREAM

Description JCD 2011-10-08 06:15:04 UTC
Private LastLoadedList As Object

Public Sub Reload()

            Reload(LastLoadedList)
'ERROR HERE
        End Sub

Public Sub Reload(Of T)(ByVal list As MyBindingList(Of T))
'Because I don't know the type T I just used Object.
'IBindingList does not work, because I need to be able to get the type, but
'Object does work in VS/Windows 7.
End Sub

Imports System.ComponentModel



Namespace Data



    Public Class MyBindingList(Of T)

        Inherits BindingList(Of T)

        Implements IBindingList


'...
    End Class

End Namespace

Error Message: Error VBNC99997: You've encountered something in the compiler which is not implemented. Please file a bug (see instructions here: http://mono-project.com/Bugs) (VBNC99997) (MoneyPig)
Comment 1 Rolf Bjarne Kvinge [MSFT] 2011-10-10 04:02:16 UTC
Smaller test case:

Imports System.Collections.Generic
Public Class Test
  Private LastLoadedList As Object
  Public Sub Reload(Of T)(ByVal list As List(Of T))
    Reload(LastLoadedList)
  End Sub
End Class

The reason is that the compiler doesn't know which type argument to use when calling Reload(Of T). This should be looked up at runtime, but this case never occurred to me when writing that code, so until I fix it it won't work.

The easiest workaround would probably be to remove the type argument from the Reload method, but it depends on your code how easy that would be or if there is another way.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2018-05-22 12:01:43 UTC
Moved to: https://github.com/mono/mono-basic/issues/24