diff --git a/src/Playwright/Transport/Connection.cs b/src/Playwright/Transport/Connection.cs index 7403654630..65aa7c9971 100644 --- a/src/Playwright/Transport/Connection.cs +++ b/src/Playwright/Transport/Connection.cs @@ -440,7 +440,11 @@ internal async Task WrapApiCallAsync(Func> action, bool isInternal var sf = st.GetFrame(i); string fileName = sf.GetFileName(); string cSharpNamespace = sf.GetMethod().ReflectedType.Namespace; - bool playwrightInternal = cSharpNamespace == "Microsoft.Playwright" || cSharpNamespace.StartsWith("Microsoft.Playwright.Core", StringComparison.InvariantCultureIgnoreCase) || cSharpNamespace.StartsWith("Microsoft.Playwright.Transport", StringComparison.InvariantCultureIgnoreCase) || cSharpNamespace.StartsWith("Microsoft.Playwright.Helpers", StringComparison.InvariantCultureIgnoreCase); + bool playwrightInternal = cSharpNamespace != null && + (cSharpNamespace == "Microsoft.Playwright" || + cSharpNamespace.StartsWith("Microsoft.Playwright.Core", StringComparison.InvariantCultureIgnoreCase) || + cSharpNamespace.StartsWith("Microsoft.Playwright.Transport", StringComparison.InvariantCultureIgnoreCase) || + cSharpNamespace.StartsWith("Microsoft.Playwright.Helpers", StringComparison.InvariantCultureIgnoreCase)); if (string.IsNullOrEmpty(fileName) && !playwrightInternal) { continue;