question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not find 'BlazorExtensions' in 'window' (Server mode)

See original GitHub issue

In a new project, using server side template, I added the reference to BlazorExtensions storage (0.2.1), added the services.AddStorage() line to register the services. If I modify the counter example to this:

`@page “/counter” @using Blazor.Extensions.Storage @inject SessionStorage sessionStorage @inject LocalStorage localStorage

Counter

Current count: @currentCount

<button class=“btn btn-primary” @onclick=“IncrementCount”>Click me</button>

@code { int currentCount = 0;

async void IncrementCount()
{
    currentCount=await localStorage.GetItem<int>("counter");
    currentCount++;
    localStorage.SetItem("counter", currentCount).Wait();
}

} ` I receive the error Could not find ‘BlazorExtensions’ in ‘window’. blazor.server.js is present in Sources when I enter in dev mode in chrome. dotnet --version outputs 3.0.100-preview7-012821.

Is that correct?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:17 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
rovercodercommented, Dec 16, 2019

Add this to your index.html or _Host.cshtml whichever you are using:

<script type="text/javascript" src="_content/Blazor.Extensions.Storage.JS"></script>

Should the blazor.extensions.storage.js file not get automatically generated clone this github repo and build the solution. You should then find the compiled js there inside the dist folder, then just copy it over to your project in /bin/Debug/netstandardx.x/dist/_content/

2reactions
cpsaezcommented, Aug 13, 2019

If i compile the .ts scripts, put in wwwroot and init the script directly in _host.cshtml it works, so I think is related to https://github.com/BlazorExtensions/Storage/issues/24

Read more comments on GitHub >

github_iconTop Results From Across the Web

blazor - Could not find 'BlazorInputFile' in 'window'
If that doesn't work, I have a Nuget project with a working sample project that uses a wrapper to Steve Sanderson Blazor File...
Read more >
Persist values by user - Radzen IDE (Blazor server-side)
Learn how to persist state in Blazor Server apps. ... Could not find 'BlazorExtensions' in 'window' (Server mode).
Read more >
Could not find 'windowMinWidthMatchesQuery' in 'window'
Hello,. I created a sample project using the mentioned template (DevExpress Blazor Server Application), but I did not manage to reproduce the ...
Read more >
Useful Visual Studio Extensions for Working with Blazor
Client software using Blazor VSCode Extensions executes C# code directly in a browser using WebAssembly. This is possible because Blazor itself ...
Read more >
Blazor WebAssembly 3.2.0 now available - .NET Blog
I'm thrilled to announce that Blazor WebAssembly is now officially released. This is a fully-featured and supported release of Blazor ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found