Skip to content
Closed
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
9 changes: 2 additions & 7 deletions src/Components/Web.JS/src/Platform/Mono/MonoDebugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ const currentBrowserIsChrome = (window as any).chrome
&& navigator.userAgent.indexOf('Edge') < 0; // Edge pretends to be Chrome


let hasReferencedPdbs = false;

export function hasDebuggingEnabled() {
return hasReferencedPdbs && currentBrowserIsChrome;
return currentBrowserIsChrome;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I see why this would be the root cause of the user reported issue.

However, this is check is too liberal now and we'll end up running with debugging enabled if the user is running a publish app (which doesn't add any PDBs to the blazor.boot.json).

We'll probably need a more conservative check that accounts for the environment the app is running in and other properties in the boot.json.

I can make these modifications on top of your PR.

Thanks for looking at this!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @captainsafia

}

export function attachDebuggerHotkey(resourceLoader: WebAssemblyResourceLoader) {
hasReferencedPdbs = !!resourceLoader.bootConfig.resources.pdb;

// Use the combination shift+alt+D because it isn't used by the major browsers
// for anything else by default
Expand All @@ -23,9 +20,7 @@ export function attachDebuggerHotkey(resourceLoader: WebAssemblyResourceLoader)
// Even if debugging isn't enabled, we register the hotkey so we can report why it's not enabled
document.addEventListener('keydown', evt => {
if (evt.shiftKey && (evt.metaKey || evt.altKey) && evt.code === 'KeyD') {
if (!hasReferencedPdbs) {
console.error('Cannot start debugging, because the application was not compiled with debugging enabled.');
} else if (!currentBrowserIsChrome) {
if (!currentBrowserIsChrome) {
console.error('Currently, only Microsoft Edge (80+), or Google Chrome, are supported for debugging.');
} else {
launchDebugger();
Expand Down