简体   繁体   中英

c# Blazor WASM Javascript not showing in debugging

I have a WASM project. I have a site.js file in the wwwroot/js folder.

I already had a javascript function here and it works fine.

I added two new functions:

function LoadLog(logValue) {
    logTa = document.getElementById("logTextArea")
    logTa.value = logValue;
    ScrollLogToBottom()
}

function ScrollLogToBottom() {
    logTa = document.getElementById("logTextArea")
    logTa.scrollTop = logTa.scrollHeight;
}

The WASM project would error out when calling these functions, and I went into debug mode.

When I looked at the site.js file - these functions were not present. The other function was present, but these were not. The file is saved (it saves automatically when you run anyway but I double checked it).

This is the debug view:

在此处输入图像描述

This is the file in Visual Studio:

在此处输入图像描述

As you can see, the Download file appears in the debugger fine - but the rest...not so much.

Is there something I am missing here?

As a further update - I deleted the Download function. I cleaned my solution. I rebuilt my solution, and then ran the solution.

The DownloadFile function was still in the js file - without the other functions...it appears as if the JS file is not being updated.

Further Further update - I deleted the entire JS folder from the Solution, and from the location on my hard drive.

When I run the Blazor app using the Chrome Extension requirement:

chrome --remote-debugging-port=9222 --user-data-dir="C:\Users.....\AppData\Local\Temp\blazor-chrome-debug" https://localhost:7054/

The JS file is still there....appears that this location is holding onto a version of the WASM application?

For anyone that happens across this.

I ran it in Edge and it was fine - no issues. It appears that Chrome is keeping a version on hand and building the solution from that.

I cleared my cache and tried again, and the functions now work as intended.

However, the debugger still showed the old JS File. It seems you have to clear the cache on the debugger Chrome as well - once this was done, the JS file appeared as updated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM