sotsera / sotsera.blazor.toaster

A Toastr.js port to Blazor in pure .Net.
https://blazor-toaster.sotsera.com/
MIT License
130 stars 29 forks source link

Fails running in RC core 3 #17

Closed uwefms closed 5 years ago

uwefms commented 5 years ago

I cannot run Toaster in server-side blazor.

This is the csproj file of the client.app: `

netstandard2.0 7.3

`

I tried:

` @using Sotsera.Blazor.Toaster.Core.Models @page "/counter" @inject Sotsera.Blazor.Toaster.IToaster toaster

Counter

Current count: @currentCount

@functions { int currentCount = 0;

void IncrementCount()
{

    currentCount++;

    toaster.Info("Now at: " + currentCount.ToString(), "Counter Info");

}

} ` In the counter component.

It works fine in Core hosted blazor.

ghidello commented 5 years ago

Hi, I didn’t tested the razor components model so can you please add some more context? Do you see any error in visual studio or the browser console? Can you verify if the toaster css file is loaded by the browser?

uwefms commented 5 years ago

@ghidello I think this is the reason: https://blogs.msdn.microsoft.com/webdev/2019/01/29/aspnet-core-3-preview-2/#sharing-component-libraries

I will have to wait for the next preview ...

Maybe you give a hint to users to avoid useless testing.

ghidello commented 5 years ago

I'm afraid is something more than that. I managed to have the toast displaying correctly loading the css directly from the index.html page as a temporary workaround for the limitation you mentioned. But then the connection with the server hangs probably for my usage of c# timers in this library (at least that's what I suspect). Anyway I've always suggested at the beginning of the project readme to use this library only on webassembly because I didn't know if it was ok to use it on server side. Where do you suggest to place that hint for having a better exposure? Anyway thanks for problem analysis and the feedback!

ghidello commented 5 years ago

Me again 😄 With the very appreciated help from @LorenDorez on Gitter, I just uploaded a new version on nuget (preview 4) that looks to be working on razor components too. There's a note on the readme about saving a local copy of the css in the server wwwroot folder as mentioned earlier.

uwefms commented 5 years ago

@ghidello Hi, thanks for caring. For some reason I cannot use the nuget package. I can install the package in VS preview 3 but while saving before compiling it gets kicked out of Dependencies/Nuget. Of course I copied the css into wwwroot. I would not waste too much time on this right now. For the next time I can go on without toaster msg as I have to solve some other problems with authentication server-side using my own database without EF and CSLA. I think after the next core 3 preview it will work again.

Thank you again

   regards 

       Uwe