Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RendererInfo causes "SyntaxError: Unexpected end of JSON input" #58977

Open
1 task done
coderdnewbie opened this issue Nov 15, 2024 · 6 comments
Open
1 task done

RendererInfo causes "SyntaxError: Unexpected end of JSON input" #58977

coderdnewbie opened this issue Nov 15, 2024 · 6 comments
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.

Comments

@coderdnewbie
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I was trying out the new RendererInfo feature in dotnet 9.0 and it fails with the error: "SyntaxError: Unexpected end of JSON input". I was following the dotnetConf 2024 Blazor Youttube video - https://www.youtube.com/watch?v=2xXc1hNwp0o.

Expected Behavior

I expect it to work like Dan Roth demoed in the dotnetConf 2024 Blazor Youttube video - https://www.youtube.com/watch?v=2xXc1hNwp0o.

Steps To Reproduce

I create a new Blazor App with the default dialog settings, but set 'Interactive render mode' as 'Auto (Server and WebAssembly)'. All the rest are defaults, so, for example 'Interactivity location' is 'Per page/component', Include sample pages is ticked etc.

Go to the Counter.razor page.

Below

<h1>Counter</h1>

add

<h2>Render mode: @RendererInfo.Name</h2>

Run it, and click Counter on the sidebar, it shows: Render mode: Static but then fails with the error "SyntaxError: Unexpected end of JSON input"

Exceptions (if any)

"SyntaxError: Unexpected end of JSON input"

Message=
Source=
StackTrace:
at https://localhost:7225/_framework/dotnet.nseotsck93.js:3:23527
at https://localhost:7225/_framework/dotnet.nseotsck93.js:3:23955
at async Le (https://localhost:7225/_framework/dotnet.nseotsck93.js:3:23228)
at async https://localhost:7225/_framework/dotnet.nseotsck93.js:3:33630
at async https://localhost:7225/_framework/dotnet.nseotsck93.js:3:39869
at async Object.create (https://localhost:7225/_framework/dotnet.nseotsck93.js:3:39839)
at async https://localhost:7225/_framework/blazor.web.js:1:155792
at async https://localhost:7225/_framework/blazor.web.js:1:165140
at https://localhost:7225/_framework/dotnet.nseotsck93.js:3:23527
at https://localhost:7225/_framework/dotnet.nseotsck93.js:3:23955
at async Le (https://localhost:7225/_framework/dotnet.nseotsck93.js:3:23228)
at async https://localhost:7225/_framework/dotnet.nseotsck93.js:3:33630
at async https://localhost:7225/_framework/dotnet.nseotsck93.js:3:39869
at async Object.create (https://localhost:7225/_framework/dotnet.nseotsck93.js:3:39839)
at async https://localhost:7225/_framework/blazor.web.js:1:155792
at async https://localhost:7225/_framework/blazor.web.js:1:165140
at Le (https://localhost:7225/_framework/dotnet.nseotsck93.js:3:24550)
at async https://localhost:7225/_framework/dotnet.nseotsck93.js:3:33630
at async https://localhost:7225/_framework/dotnet.nseotsck93.js:3:39869
at async Object.create (https://localhost:7225/_framework/dotnet.nseotsck93.js:3:39839)
at async https://localhost:7225/_framework/blazor.web.js:1:155792
at async https://localhost:7225/_framework/blazor.web.js:1:165140

.NET Version

9.0.0

Anything else?

Image

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 15, 2024
@coderdnewbie
Copy link
Author

Image

@javiercn
Copy link
Member

@coderdnewbie thanks for contacting us.

It might be a different issue. If you rebuild the project, does the issue go away? (as in Rebuil, just not Build)

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Nov 15, 2024
@coderdnewbie
Copy link
Author

I have rebuilt it (after deleting the bin and obj folders and the .vs folder), and it started working. Not sure what happened, I will reopen this issue if I see it again.

@coderdnewbie
Copy link
Author

I continued doing following the dotnet conf 2024 demo and it happened again, when I typed in:

@if (RendererInfo.IsInteractive)
{
    <button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
}
else
{
    <p>Waiting before switching to Auto ...</p>
}

Again to fix this I had to rebuilt it (after deleting the bin and obj folders and the .vs folder), and it then worked again.

This is another poor experience, in fact, very poor indeed. @danroth27 Sorry, Dan but this is another bad experience experience I am finding ... are you able to recreate this yourself?

I am opening this again as it is very confusing what is going on, and there must be a better way of handling this.

@dotnet-policy-service dotnet-policy-service bot added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Nov 15, 2024
@javiercn
Copy link
Member

@coderdnewbie It's likely a bug in the up-to-date check logic and/or accelerated builds.

Try adding the following to your .Client project

    <AccelerateBuildsInVisualStudio>false</AccelerateBuildsInVisualStudio>

@javiercn javiercn added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Nov 15, 2024
Copy link
Contributor

Hi @coderdnewbie. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.
Projects
None yet
Development

No branches or pull requests

2 participants