Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Fix #212 - Hovering over Vb globals crashes VS #552

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Framework/CorDebug/CorDebugClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int ICorDebugClass. GetStaticFieldValue (uint fieldDef, ICorDebugFrame pFrame, o
int ICorDebugClass2.GetParameterizedType( CorElementType elementType, uint nTypeArgs, ICorDebugType []ppTypeArgs, out ICorDebugType ppType )
{
// CorDebugClass.GetParameterizedType is not implemented
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, I guess this comment isn't true anymore. It is implemented, but only works for non-generic types (which is the only kind of type that ever gets requested)

ppType = null;
ppType = new CorDebugGenericType(elementType, null, this.Assembly);

return Utility.COM_HResults.S_OK;
}
Expand Down
56 changes: 51 additions & 5 deletions Framework/CorDebug/CorDebugType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,23 @@ public class CorDebugGenericType : ICorDebugType
CorElementType m_elemType;
public RuntimeValue m_rtv;
public CorDebugAppDomain m_appDomain;
private CorDebugAssembly m_assembly;

// This is used to resolve values into types when we know the appdomain, but not the assembly.
public CorDebugGenericType(CorElementType elemType, RuntimeValue rtv, CorDebugAppDomain appDomain)
{
{
m_elemType = elemType;
m_rtv = rtv;
m_appDomain = appDomain;
}

// This constructor is used exclusively for resovling potentially (but never really) generic classes into fully specified types.
// Generics are not supported by netmf, but we still need to be able to convert classes into fully specified types.
public CorDebugGenericType(CorElementType elemType, RuntimeValue rtv, CorDebugAssembly assembly)
{
m_elemType = elemType;
m_rtv = rtv;
m_appDomain = appDomain;
m_assembly = assembly;
}

int ICorDebugType.EnumerateTypeParameters(out ICorDebugTypeEnum ppTyParEnum)
Expand All @@ -102,7 +113,7 @@ int ICorDebugType.GetRank(out uint pnRank)

int ICorDebugType.GetClass(out ICorDebugClass ppClass)
{
ppClass = CorDebugValue.ClassFromRuntimeValue(m_rtv, m_appDomain);
ppClass = CorDebugValue.ClassFromRuntimeValue(m_rtv, this.AppDomain);
return Utility.COM_HResults.S_OK;
}

Expand All @@ -115,14 +126,49 @@ int ICorDebugType.GetFirstTypeParameter(out ICorDebugType value)

int ICorDebugType.GetStaticFieldValue(uint fieldDef, ICorDebugFrame pFrame, out ICorDebugValue ppValue)
{
ppValue = null;
return Utility.COM_HResults.E_NOTIMPL;
uint fd = TinyCLR_TypeSystem.ClassMemberIndexFromCLRToken(fieldDef, this.Assembly);
this.Process.SetCurrentAppDomain(this.AppDomain);
RuntimeValue rtv = this.Engine.GetStaticFieldValue(fd);
ppValue = CorDebugValue.CreateValue(rtv, this.AppDomain);

return Utility.COM_HResults.S_OK;
}

int ICorDebugType.GetBase(out ICorDebugType pBase)
{
pBase = null;
return Utility.COM_HResults.E_NOTIMPL;
}

public CorDebugAssembly Assembly
{
[System.Diagnostics.DebuggerHidden]
get { return m_assembly; }
}

public Engine Engine
{
[System.Diagnostics.DebuggerHidden]
get { return this.Process?.Engine; }
}

public CorDebugProcess Process
{
[System.Diagnostics.DebuggerHidden]
get { return this.Assembly?.Process; }
}

public CorDebugAppDomain AppDomain
{
[System.Diagnostics.DebuggerHidden]
get
{
if (m_appDomain != null)
return m_appDomain;
else
return this.Assembly?.AppDomain;
}
}

}
}