Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug in Application Insights client-side Javascript script block. #3122

Description

@foggerty

.NET Version 10.
Application Insights V3

The documentation here has a Javascript `<script> block for us to copy/paste into our HTML for Application Insights integration.

When I do so, Visual Studio highlights the entire function plus a large chunk of the HTML above it with the error No overload for method 'write' takes 0 arguments.

If you follow these and it's easy to reproduce:

  1. Create a new ASP.NET (or Blazor) application.
  2. Paste the Javascript from the link above into any cshtml file.
  3. You should see the error.

Note that if the .cshtml file only contains the script block (i.e. no <html> or <head> tags) then you get another error (RZ1005):

"".concat(n[4]),l=window.fetch,t=function(e){if(!e.ext||!e.ext[i]||!e.ext[i].file)throw Error("" is not valid at the start of a code block.  Only identifiers, keywords, comments, "(" and "{" are valid.

Not being a Javascript dev, I'm not even going to touch that one 🙂

Note that this causes a compilation error (also tested with CLI dotnet build), so it's not Visual Studio's code insight getting things wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions