+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Text;
-
-namespace Internal.TypeSystem
-{
- partial class MethodDesc
- {
- partial void GetDiagnosticName(ref string diagnosticName)
- {
- diagnosticName = DiagnosticName;
- }
- }
-}
if (includeReturnType)
{
- DebugNameFormatter.Instance.AppendName(sb, ReturnType, DebugNameFormatter.FormatOptions.None | DebugNameFormatter.FormatOptions.UseDiagnosticName);
+ DebugNameFormatter.Instance.AppendName(sb, ReturnType, DebugNameFormatter.FormatOptions.None);
sb.Append('(');
}
first = false;
else
sb.Append(',');
- DebugNameFormatter.Instance.AppendName(sb, param, DebugNameFormatter.FormatOptions.None | DebugNameFormatter.FormatOptions.UseDiagnosticName);
+ DebugNameFormatter.Instance.AppendName(sb, param, DebugNameFormatter.FormatOptions.None);
}
if (includeReturnType)
}
catch
{
- string diagName = null;
- GetDiagnosticName(ref diagName);
- if (diagName == null)
- throw;
+ string diagName = "Unknown";
+ try
+ {
+ diagName = DiagnosticName;
+ }
+ catch {}
sb.Append(diagName);
}
{
sb.Append(',');
}
- DebugNameFormatter.Instance.AppendName(sb, Instantiation[i], DebugNameFormatter.FormatOptions.None | DebugNameFormatter.FormatOptions.UseDiagnosticName);
+ DebugNameFormatter.Instance.AppendName(sb, Instantiation[i], DebugNameFormatter.FormatOptions.None);
}
if (!first)
sb.Append('>');
return sb.ToString();
}
-
- partial void GetDiagnosticName(ref string diagnosticName);
}
}
{
public override string ToString()
{
- return DebugNameFormatter.Instance.FormatName(this, DebugNameFormatter.FormatOptions.Default | DebugNameFormatter.FormatOptions.UseDiagnosticName);
+ return DebugNameFormatter.Instance.FormatName(this, DebugNameFormatter.FormatOptions.Default);
}
}
}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Text;
-
-using Debug = System.Diagnostics.Debug;
-
-namespace Internal.TypeSystem
-{
- partial class DebugNameFormatter
- {
- partial void GetDiagnosticName(GenericParameterDesc type, ref string diagnosticName)
- {
- try
- {
- diagnosticName = type.DiagnosticName;
- }
- catch {}
- }
-
- partial void GetDiagnosticName(DefType type, ref string diagnosticName)
- {
- try
- {
- diagnosticName = type.DiagnosticName;
- }
- catch {}
- }
- }
-}
{
public partial class DebugNameFormatter : TypeNameFormatter<DebugNameFormatter.Void, DebugNameFormatter.FormatOptions>
{
- partial void GetDiagnosticName(GenericParameterDesc type, ref string diagnosticName);
- partial void GetDiagnosticName(DefType type, ref string diagnosticName);
-
public static readonly DebugNameFormatter Instance = new DebugNameFormatter();
public override Void AppendName(StringBuilder sb, ArrayType type, FormatOptions options)
{
sb.Append(type.Name);
}
- catch when ((options & FormatOptions.UseDiagnosticName) != 0)
+ catch
{
string diagnosticName = "Unknown";
GetDiagnosticName(type, ref diagnosticName);
{
sb.Append(nestedType.Name);
}
- catch when ((options & FormatOptions.UseDiagnosticName) != 0)
+ catch
{
string diagnosticName = "Unknown";
GetDiagnosticName(nestedType, ref diagnosticName);
sb.Append(type.Name);
}
- catch when ((options & FormatOptions.UseDiagnosticName) != 0)
+ catch
{
sb.Length = initialLen;
{
assemblyName = ((IAssemblyDesc)mdType.Module).GetName().Name;
}
- catch when ((options & FormatOptions.UseDiagnosticName) != 0)
+ catch
{
assemblyName = "Unknown";
}
{
return possibleInnerType.ContainingType;
}
- catch when ((options & FormatOptions.UseDiagnosticName) != 0)
+ catch
{
return null;
}
}
+ private void GetDiagnosticName(GenericParameterDesc type, ref string diagnosticName)
+ {
+ try
+ {
+ diagnosticName = type.DiagnosticName;
+ }
+ catch {}
+ }
+
+ private void GetDiagnosticName(DefType type, ref string diagnosticName)
+ {
+ try
+ {
+ diagnosticName = type.DiagnosticName;
+ }
+ catch {}
+ }
+
public struct Void
{
public static Void Value => default(Void);
public TState AppendName(StringBuilder sb, TypeDesc type, TOptions options)
{
TypeFlags category;
- bool normalCategoryComputation = false;
try
{
category = type.Category;
- normalCategoryComputation = true;
}
catch
{
case TypeFlags.SignatureMethodVariable:
return AppendName(sb, (SignatureMethodVariable)type, options);
default:
- Debug.Assert(normalCategoryComputation && type.IsDefType); // Don't call type.IsDefType if Category computation failed
return AppendName(sb, (DefType)type, options);
}
}
<Compile Include="..\Common\TypeSystem\Common\Utilities\DebugNameFormatter.cs">
<Link>Utilities\DebugNameFormatter.cs</Link>
</Compile>
- <Compile Include="..\Common\TypeSystem\Common\Utilities\DebugNameFormatter.Diagnostic.cs">
- <Link>Utilities\DebugNameFormatter.Diagnostic.cs</Link>
- </Compile>
<Compile Include="..\Common\TypeSystem\Common\Utilities\LockFreeReaderHashtable.cs">
<Link>Utilities\LockFreeReaderHashtable.cs</Link>
</Compile>
<Compile Include="..\Common\TypeSystem\Common\MethodDesc.ToString.cs">
<Link>TypeSystem\Common\MethodDesc.ToString.cs</Link>
</Compile>
- <Compile Include="..\Common\TypeSystem\Common\MethodDesc.ToString.Diagnostic.cs">
- <Link>TypeSystem\Common\MethodDesc.ToString.Diagnostic.cs</Link>
- </Compile>
<Compile Include="..\Common\TypeSystem\Common\MetadataVirtualMethodAlgorithm.cs">
<Link>TypeSystem\Common\StandardVirtualMethodAlgorithm.cs</Link>
</Compile>