Skip to content
This repository was archived by the owner on Jan 27, 2019. It is now read-only.

Prevent exception when BAML strings contain invalid TypeName chars #507

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 11 additions & 2 deletions Confuser.Renamer/BAML/BAMLAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,17 @@ void ProcessElementBody(BamlElement root, BamlElement elem) {
value = strings[((TextWithIdRecord)txt).ValueId].Value;

string prefix;
TypeSig sig = ResolveType(value.Trim(), out prefix);
if (sig != null && context.Modules.Contains((ModuleDefMD)sig.ToBasicTypeDefOrRef().ResolveTypeDefThrow().Module)) {

TypeSig sig = null;

//Prevent unhandled exception when BAML strings contain invalid TypeName chars
try
{
sig = ResolveType(value.Trim(), out prefix);
}
catch(TypeNameParserException) {}

if (sig != null && context.Modules.Contains((ModuleDefMD)sig.ToBasicTypeDefOrRef().ResolveTypeDefThrow().Module)) {
var reference = new BAMLConverterTypeReference(xmlnsCtx, sig, txt);
AddTypeSigReference(sig, reference);
}
Expand Down