Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: Evaluation - 05.12

>
>
>
Examples of errors detected by the V313…

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