Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EE: Cannot assign to generic field #6576

Open
plnelson opened this issue Nov 5, 2015 · 2 comments
Open

EE: Cannot assign to generic field #6576

plnelson opened this issue Nov 5, 2015 · 2 comments

Comments

@plnelson
Copy link
Contributor

plnelson commented Nov 5, 2015

  1. Run the following code:
class C<T>
{
    private T f;

    public void Func()
    {
        System.Diagnostics.Debugger.Break();
    }
}
class Program
{
    static void Main(string[] args)
    {
        C<int> c = new C<int>();
        c.Func();
    }
}
  1. Evaluate "f = 3"

Expected: "3" - and value is updated

Actual: "error CS0029: Cannot implicitly convert type 'int' to 'T'"

@plnelson
Copy link
Contributor Author

plnelson commented Nov 5, 2015

We'll likely need to coordinate on this one. Unfortunately, GetClrGenericParameters requires a DkmStackWalkFrame, but the EC only has access to a DkmClrInstructionAddress.

@plnelson
Copy link
Contributor Author

Related case (from Jared Parsons):

Public Class Dog
    Public Function Bark() As String
        Return "Woof!!!"
    End Function
End Class

Public Class Example(Of T)
    Public Field As T
    Public Sub Method1()
        Stop
    End Sub
End Class

Module Module1

    Sub Main()
        Dim v1 = New Example(Of Dog) With {.Field = New Dog()}
        v1.Method1()
    End Sub

End Module

When stopped, evaluate Field.Bark(). Works in old EE. Doesn't work in new EE.

@ManishJayaswal ManishJayaswal modified the milestones: 2.1, 2.0 (RTM) Jan 4, 2017
@jinujoseph jinujoseph modified the milestones: 15.1, 15.later May 22, 2017
@jinujoseph jinujoseph modified the milestones: 15.6, Unknown Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants