r/Blazor • • Nov 07 '21

Blazor stability *vent*

I truly hope Microsoft can FIX the stability of the Blazor WASM environment. I'm building a Blazor application on 2019, and it is failing in unchanged code with zero useful information.
Once more, I have to toss my code base and start from scratch. It sucks and wastes SO MUCH TIME.

0 Upvotes

39 comments sorted by

9

u/j-sakamoto Nov 07 '21

I think almost all people who are Blazor WASM app developers feel it's stable enough.
I guess your case is one of the unfortunate edge cases.
Just curious, would you explain what problem you encountered more precisely?
Can you disclose a part of your Blazor WASM program code somewhere?

9

u/Weary-Dealer4371 Nov 08 '21

I've been building a blazor app since January 2020 and never once had to completely scrap and start over.

3

u/SeekingSolace2008 Nov 08 '21

Happy to hear. This is my 3rd restart. The code-base gets to a point I can no longer advance. Compiles, yet will not run for an undescriptive reason. My app is reasonably simple. Hoping restarting in VS2022 will be better.

3

u/Weary-Dealer4371 Nov 08 '21

Can you show the error thats coming up?

1

u/SeekingSolace2008 Nov 08 '21

This is happening in the Configure method in startup.cs.
System.InvalidOperationException: 'Type '' is not supported.'
on the app.UseIdentityServer(); line. I have reviewed numerous articles on Microsoft, StackOverflow and a few other sites, with no solution.
This section of code was not modified. It ran fine a week ago, then I refactored my Profile API, and now it no longer runs, failing on startup.

0

u/[deleted] Nov 08 '21

[deleted]

1

u/SeekingSolace2008 Nov 08 '21

I did. I also reverted the changes. Same failure.

3

u/Weary-Dealer4371 Nov 08 '21

An error saying Type isn't available might mean you have some nuget packages out of sync. What your references look like in your client and server apps

1

u/SeekingSolace2008 Nov 08 '21

All are up-to-date, and running the latest version of VS2019, 16.11.5.

2

u/Weary-Dealer4371 Nov 08 '21

You said api, is this a asp.net hosted WASM app? Is it the api code that's failing or blazor?

1

u/SeekingSolace2008 Nov 08 '21

As stated above, it's failing in the startup.cs, in Server, that starts the IdentityServer.

3

u/j-sakamoto Nov 08 '21

Hum... I feel it is a Identity Server's problem, not a Blazor's problem.

Doesn't it?

→ More replies (0)

5

u/here_I_come Nov 08 '21

I got some weird errors when I updated some nuget packages at work and then came home pulled from git and didn't clean nuget cache and didn't update them. Once I did that everything worked without those weird errors, maybe you can try that. Also another thing to try is make sure no file backup programs are running on your project directory. I had google drive for desktop running and apparently it locks some files that VS needs to compile the solution properly. So when I am really working I close the google program, then when I am done I run it again so it could update my changes and upload them.

1

u/Askk8 Nov 08 '21

Clear the cache?

2

u/slideomix Nov 08 '21

I've found that exiting VS and deleting the .vs directory can do wonders for stuff like this. Not sure why it happens, but I've definitely seen some weirdness like this even in cli apps

1

u/SeekingSolace2008 Nov 08 '21

Definitely not something I had tried. Just did it, and no change. Same failure.
But, thanks for the tip. It'll be part of my "Try This List".

1

u/slideomix Nov 08 '21

ConfigureClients

What about something in your appsettings.json? Did something get moved around or removed from there?

1

u/SeekingSolace2008 Nov 08 '21

No changes in the appsettings.json
Here it is:

{

"ConnectionStrings": {

"DefaultConnection": "Server=*****;Database=MainData;Trusted_Connection=True;MultipleActiveResultSets=true"

},

"jwt": {

"key": "******"

},

"Logging": {

"LogLevel": {

"Default": "Information",

"Microsoft": "Warning",

"Microsoft.Hosting.Lifetime": "Information"

}

},

"IdentityServer": {

"Clients": {

"Topaz.Client": {

"ApplicationUser": "IdentityServerSPA"

}

}

},

"AllowedHosts": "*",

"Serilog": {

"MinimumLevel": {

"Default": "Information",

"Override": {

"Microsoft": "Warning",

"System": "Warning"

}

},

"Enrich": ["FromLogContext","WithMachineName","WithProcessId","WithThreadId"],

"WriteTo": [

{

"Name": "MSSqlServer",

"Args": {

"connectionString": "Server=***;Database=Logs;Trusted_Connection=True;MultipleActiveResultSets=true",

"tableName": "Logs",

"autoCreateSqlTable": true

}

}

]

}

}

3

u/SeekingSolace2008 Nov 07 '21

1

u/j-sakamoto Nov 08 '21

Thank you for disclosing your code.

Could you explain in more detail the "System.InvalidOperationException: 'Type '' is not supported.' " exception?

I want to know which line in your Startup is the first point for that exception.

Could you disclose the stack trace of that exception?

1

u/SeekingSolace2008 Nov 08 '21

Here is the stack trace of the error.
line 247 is: app.UseIdentityServer();

As for the exception, there appears to be a type not set. But, I'm not finding a clue as to what is not set or mis-set. I have reviewed the code, and haven't found the issue.

at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureClients.<GetClients>d__6.MoveNext()

at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ConfigureClients.Configure(ApiAuthorizationOptions options)

at Microsoft.Extensions.Options.OptionsFactory\1.Create(String name)`

at Microsoft.Extensions.Options.OptionsManager\1.<>c__DisplayClass5_0.<Get>b__0()`

at System.Lazy\1.ViaFactory(LazyThreadSafetyMode mode)`

at System.Lazy\1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)`

at System.Lazy\1.CreateValue()`

at System.Lazy\1.get_Value()`

at Microsoft.Extensions.Options.OptionsCache\1.GetOrAdd(String name, Func`1 createOptions)`

at Microsoft.Extensions.Options.OptionsManager\1.Get(String name)`

at Microsoft.Extensions.Options.OptionsManager\1.get_Value()`

at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderConfigurationExtensions.<>c.<AddClients>b__8_1(IServiceProvider sp)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor\2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)`

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor\2.VisitCallSite(ServiceCallSite callSite, TArgument argument)`

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor\2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)`

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor\2.VisitCallSite(ServiceCallSite callSite, TArgument argument)`

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor\2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)`

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor\2.VisitCallSite(ServiceCallSite callSite, TArgument argument)`

at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)

at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)

at Microsoft.AspNetCore.Builder.IdentityServerApplicationBuilderExtensions.TestService(IServiceProvider serviceProvider, Type service, ILogger logger, String message, Boolean doThrow)

at Microsoft.AspNetCore.Builder.IdentityServerApplicationBuilderExtensions.Validate(IApplicationBuilder app)

at Microsoft.AspNetCore.Builder.IdentityServerApplicationBuilderExtensions.UseIdentityServer(IApplicationBuilder app, IdentityServerMiddlewareOptions options)

at Forcible.Server.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ApplicationDbContext context, RoleManager\1 roleManager, UserManager`1 userManager, IAlternateKey alternateKey, IAuditPrimaryKey auditPrimary, IBackgroundJobClient backgroundJobClient, IRecurringJobManager recurringJobManager) in E:\Repo\Forcible\Forcible\Server\Startup.cs:line 247`

4

u/slideomix Nov 08 '21

5

u/SeekingSolace2008 Nov 08 '21

Wow... That was it. It looks like the issue was an abhorrent change to appsettings.json. I did compare and check my *.cs files, and reviewed the appsettings.json, but it seemed ok. I totally missed that the Profile was changed to ApplicationUser. Made that change, and my code launches again.
Thanks for the assistance.

1

u/slideomix Nov 08 '21

Glad it is working!

1

u/SeekingSolace2008 Nov 08 '21

Me too - Again thanks.

1

u/j-sakamoto Nov 08 '21

Congrats! 😊

12

u/thorpj Nov 07 '21

try a dotnet clean

3

u/[deleted] Nov 07 '21

they call it the bleeding edge for a reason

1

u/VirtualPAH Nov 09 '21

I'd look at using Visual Studio 2022 and upgrade everything to .Net 6, which won't work on VS2019.

Could well be breaking changes as you've upgraded along the way, so could try creating a new project and comparedefault skeleton config to current to see if anything needs altering or updating.

As Blazor is so new hopefully now we have official release of .Net 6 (no longer preview or release candidate) with long term support, upgrading to that will solve all problems or at least give a clean slate to get support about.

I've had to scratch projects in the past when moving up the Blazor versions towards .Net 5 as they were improving things so much quickly there were inevitably breaking changes.

Didn't take me long to create a new project using the latest visual studio template and copy the source code files over, but hopefully moving to VS2022 and .Net 6 won't require that kind of action anymore.

Alternatively could look at rolling back the VS2019 updates or nuget package installs to see if the problem goes away then use that stable version without any further updates until ready to move to VS2022 and .Net 6.

-1

u/[deleted] Nov 08 '21 edited Nov 08 '21

Wait, are you counting on Microsoft to release software that isn't permanently POC? They just announced they are going to drop UWP for crying out loud. If you want something stable from Microsoft, go learn WinForms.

I realize this is controversial on this sub, but that's my experience with pretty much all Microsoft products be it Windows, Blazor, UWP or WPF.

3

u/SeekingSolace2008 Nov 08 '21

Laughing... Thanks

1

u/GroundTeaLeaves Nov 08 '21

They are dropping UWP? Not that I like it at all, but Microsoft has been trying so hard to get people to use it and they don't seem to understand why people don't like it.

2

u/[deleted] Nov 08 '21

Yeah you can read about it here. People who could did use UWP, but there’s just not anyone developing Windows specific desktop apps these days. But them dropping UWP for whatever new framework M feels like using today is just a hilariously good representation of Microsoft

0

u/[deleted] Nov 07 '21

[deleted]

-1

u/SeekingSolace2008 Nov 07 '21

Current code-base compiles, but will not run. I get a bogus type '' is not supported for UseIdentityServer(). This code has not changed, and now throws this error. I have read several articles on the issue, and none of the solutions resolve the issue. At this point, I have concluded this code-base is dead, and need to restart.

4

u/webdevguyneedshelp Nov 07 '21

You should use vs 2022 preview. It's buggy but it at least works. I couldn't use 2019 for blazor

6

u/x6060x Nov 07 '21 edited Nov 08 '21

Wait till tomorrow for the full version.

2

u/[deleted] Nov 09 '21

if only it worked... hot reload is a no-go for me...

See post in VisualStudio.