Examples of errors detected by the V3138 diagnostic
V3138. String literal contains potential interpolated expression.
.NET Core Libraries (CoreFX)
V3138 String literal contains potential interpolated expression. Consider inspecting: e. SSPIHandleCache.cs 42
internal static void CacheCredential(SafeFreeCredentials newHandle)
{
try
{
....
}
catch (Exception e)
{
if (!ExceptionCheck.IsFatal(e))
{
NetEventSource.Fail(null, "Attempted to throw: {e}");
}
}
}
.NET Core Libraries (CoreFX)
V3138 String literal contains potential interpolated expression. Consider inspecting: algorithm. AuthenticationHelper.Digest.cs 58
public static async Task<string> GetDigestTokenForCredential(....)
{
....
if (NetEventSource.IsEnabled)
NetEventSource.Error(digestResponse,
"Algorithm not supported: {algorithm}");
....
}
Ryujinx
V3138 String literal contains potential interpolated expression. Consider inspecting: keyHash. CacheCollection.cs 524
public void AddValue(ref Hash128 keyHash, byte[] value)
{
if (IsReadOnly)
{
Logger.Warning?.Print(LogClass.Gpu,
"Trying to add {keyHash} on a read-only cache, ignoring.");
....
}
....
}
Similar errors can be found in some other places:
- V3138 String literal contains potential interpolated expression. Consider inspecting: keyHash. CacheCollection.cs 475
.NET 6 libraries
V3138 String literal contains potential interpolated expression. Consider inspecting: _pressureHigh. PhysicalMemoryMonitor.cs 110
internal void SetLimit(int physicalMemoryLimitPercentage)
{
if (physicalMemoryLimitPercentage == 0)
{
// use defaults
return;
}
_pressureHigh = Math.Max(3, physicalMemoryLimitPercentage);
_pressureLow = Math.Max(1, _pressureHigh - 9);
Dbg.Trace($"MemoryCacheStats",
"PhysicalMemoryMonitor.SetLimit:
_pressureHigh={_pressureHigh}, _pressureLow={_pressureLow}");
}
.NET 6 libraries
V3138 String literal contains potential interpolated expression. Consider inspecting: spec. MetricsEventSource.cs 381
private void ParseSpecs(string? metricsSpecs)
{
....
string[] specStrings = ....
foreach (string specString in specStrings)
{
if (!MetricSpec.TryParse(specString, out MetricSpec spec))
{
Log.Message("Failed to parse metric spec: {specString}");
}
else
{
Log.Message("Parsed metric: {spec}");
....
}
}
}
Unity C# reference source code
V3138 String literal contains potential interpolated expression. Consider inspecting: type. OverlayUtilities.cs 116
public static Overlay CreateOverlay(Type type)
{
....
if (overlay == null)
{
Debug.LogWarning("Overlay of type {type} can not be instantiated." + ....);
return null;
}
....
}
Orleans
V3138 String literal contains potential interpolated expression. Consider inspecting: type. ExceptionCodec.cs 367
public Exception DeserializeException<TInput>(....)
{
if (!_typeConverter.TryParse(typeName, out var type))
{
....
}
else if (typeof(Exception).IsAssignableFrom(type))
{
....
}
else
{
throw new NotSupportedException("Type {type} is not supported");
}
}
AWS SDK for .NET
V3138 String literal contains potential interpolated expression. Consider inspecting: part. Fn.cs 82
public static object GetAttr(object value, string path)
{
....
var parts = path.Split('.');
....
for (int i = 0; i < parts.Length; i++)
{
var part = parts[i];
....
if (!(propertyValue is IList))
throw
new ArgumentException("Object addressing by pathing segment '{part}'
with indexer must be IList");
....
if (!(propertyValue is IPropertyBag))
throw
new ArgumentException("Object addressing by pathing segment '{part}'
must be IPropertyBag");
....
}
....
}
Similar errors can be found in some other places:
- V3138 String literal contains potential interpolated expression. Consider inspecting: part. Fn.cs 93