Skip to content

Commit 84a384b

Browse files
committed
Fix bug with exclusion classes failing
- Add commented code to help on debug. Signed-off-by: José Simões <[email protected]>
1 parent d99cce3 commit 84a384b

File tree

3 files changed

+42
-23
lines changed

3 files changed

+42
-23
lines changed

source/MetadataProcessor.Core/nanoSkeletonGenerator.cs

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,35 +120,40 @@ private void GenerateAssemblyLookup()
120120
{
121121
if (c.IncludeInStub())
122122
{
123-
var className = NativeMethodsCrc.GetClassName(c);
124-
125-
foreach (var m in nanoTablesContext.GetOrderedMethods(c.Methods))
123+
// don't include if it's on the exclude list
124+
if (!IsClassToExclude(c))
126125
{
127-
var rva = _tablesContext.ByteCodeTable.GetMethodRva(m);
126+
var className = NativeMethodsCrc.GetClassName(c);
128127

129-
// check method inclusion
130-
// method is not a native implementation (RVA 0xFFFF) and is not abstract
131-
if ((rva == 0xFFFF &&
132-
!m.IsAbstract))
128+
foreach (var m in nanoTablesContext.GetOrderedMethods(c.Methods))
133129
{
134-
assemblyLookup.LookupTable.Add(new Method()
135-
{
136-
Declaration = $"Library_{_project}_{className}::{NativeMethodsCrc.GetMethodName(m)}"
137-
});
138-
}
139-
else
140-
{
141-
// method won't be included, still
142-
// need to add a NULL entry for it
143-
// unless it's on the exclude list
130+
var rva = _tablesContext.ByteCodeTable.GetMethodRva(m);
144131

145-
if (!IsClassToExclude(c))
132+
// check method inclusion
133+
// method is not a native implementation (RVA 0xFFFF) and is not abstract
134+
if ((rva == 0xFFFF &&
135+
!m.IsAbstract))
146136
{
147137
assemblyLookup.LookupTable.Add(new Method()
148138
{
149-
Declaration = "NULL"
139+
Declaration = $"Library_{_project}_{className}::{NativeMethodsCrc.GetMethodName(m)}"
150140
});
151141
}
142+
else
143+
{
144+
// method won't be included, still
145+
// need to add a NULL entry for it
146+
// unless it's on the exclude list
147+
148+
if (!IsClassToExclude(c))
149+
{
150+
assemblyLookup.LookupTable.Add(new Method()
151+
{
152+
Declaration = "NULL"
153+
//Declaration = $"**Library_{_project}_{NativeMethodsCrc.GetClassName(c)}::{NativeMethodsCrc.GetMethodName(m)}"
154+
});
155+
}
156+
}
152157
}
153158
}
154159
}
@@ -160,11 +165,12 @@ private void GenerateAssemblyLookup()
160165

161166
if (!IsClassToExclude(c))
162167
{
163-
for (int i = 0; i < c.Methods.Count; i++)
168+
foreach (var m in nanoTablesContext.GetOrderedMethods(c.Methods))
164169
{
165170
assemblyLookup.LookupTable.Add(new Method()
166171
{
167172
Declaration = "NULL"
173+
//Declaration = $"**Library_{_project}_{NativeMethodsCrc.GetClassName(c)}::{NativeMethodsCrc.GetMethodName(m)}"
168174
});
169175
}
170176
}

source/native/Tools.MetaDataProcessor/Info_Win32.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ static const CHAR c_Definition_Begin[] =
463463
"static const CLR_RT_MethodHandler method_lookup[] =\n"
464464
"{\n";
465465

466-
static const CHAR c_Definition_Body[] = " Library_%S_%s::%s,\n";
466+
static const CHAR c_Definition_Body[] = " Library_%S_%s::%s,\n";
467+
static const CHAR c_Definition_Body_Invalid[] = " **Library_%S_%s::%s,\n";
467468

468469
static const CHAR c_Definition_End[] =
469470

@@ -1777,6 +1778,14 @@ void CLR_RT_Assembly::GenerateSkeleton_NoInterop(LPCWSTR szFileName, LPCWSTR szP
17771778
}
17781779
else
17791780
{
1781+
////////////////////////////////////////////////////
1782+
////////////////////////////////////////////////////
1783+
// use when debugging to output invalid declaration
1784+
//BuildMethodName(md, name, mapMethods);
1785+
//Dump_Printf(c_Definition_Body_Invalid, szName, cls_name.c_str(), name.c_str());
1786+
////////////////////////////////////////////////////
1787+
////////////////////////////////////////////////////
1788+
17801789
Dump_Printf(" NULL,\n");
17811790
}
17821791
}

source/native/Tools.Parser/AssemblyParser.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2711,7 +2711,11 @@ HRESULT MetaData::Parser::RemoveUnused()
27112711

27122712
std::wstring str; TokenToString( tk, str );
27132713

2714-
if(m_setFilter_ExcludeClassByName.find( str ) != m_setFilter_ExcludeClassByName.end()) continue;
2714+
if (m_setFilter_ExcludeClassByName.find(str) != m_setFilter_ExcludeClassByName.end())
2715+
{
2716+
wprintf(L"Excluding %s\n", str.c_str());
2717+
continue;
2718+
}
27152719

27162720
setNew.insert( tk );
27172721
}

0 commit comments

Comments
 (0)