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

Black screen instead of exception page #228

Closed
Dreamescaper opened this issue Nov 12, 2020 · 14 comments · Fixed by #229
Closed

Black screen instead of exception page #228

Dreamescaper opened this issue Nov 12, 2020 · 14 comments · Fixed by #229
Labels
area-mobileblazorbindings Experimental Mobile Bindings for Blazor bug Something isn't working
Milestone

Comments

@Dreamescaper
Copy link
Contributor

In most cases for me when exception happens I simple see fully black screen. I see some text when try to scroll the page, but that doesn't help.
That makes debugging hell of a lot harder, considering that exceptions are not logged anywhere else!

I'm trying to find concise repro case for this behavior.

Details

Mryhbqn1HZ

@Eilon
Copy link
Member

Eilon commented Nov 12, 2020

Oh I wonder if this is related to dark/light mode? That's probably a bug in the default error screen.

Or, it kind of looks like you've entered The Matrix! (But with blue text instead of green.)

@Dreamescaper
Copy link
Contributor Author

No, not related to dark/light mode.
Under some conditions it's ok, sometimes like that with same device settings.

@Eilon
Copy link
Member

Eilon commented Nov 12, 2020

Hmm that's quite odd then. I think for that screen it might not set all the foreground/background colors and if you're in dark/light mode that can create bad combinations (e.g. black on black). That's usually the problem when I see such problems.

@Eilon
Copy link
Member

Eilon commented Nov 12, 2020

This is the error UI:

https://github.com/xamarin/MobileBlazorBindings/blob/master/src/Microsoft.MobileBlazorBindings/ErrorPageHelper.cs#L24-L55

Looking at it now, I don't see any colors set at all, so this is certainly odd. But maybe setting explicit colors is best to avoid any risk of inheriting some bad color combinations from something.

@Dreamescaper
Copy link
Contributor Author

Sometimes I get the opposite - simple white screen, nothing else.

@Eilon
Copy link
Member

Eilon commented Nov 12, 2020

I'm guessing it's doing black on black and white on white. I think setting explicit colors is the right approach.

@Eilon
Copy link
Member

Eilon commented Nov 12, 2020

It would be nice to be theme-aware using a little helper like this:

https://github.com/Eilon/Rezipe/blob/master/src/Rezipe/RezipeBaseComponent.cs#L29-L32

@Dreamescaper
Copy link
Contributor Author

Dreamescaper commented Nov 12, 2020

OK, I see that I get simple white screen when my Shell fails to create, and I had no such line in my App:
MainPage = new ContentPage();

(didn't think that it mattered).

But adding this line fixed this particular issue - not the black screen though, so I keep digging.

@Eilon
Copy link
Member

Eilon commented Nov 12, 2020

Ah yes you need to set some initial value for MainPage because all the Blazor stuff loads async. So you could have just an empty ContentPage or you could even put a splash screen there. The Blazor stuff loads very quickly (depending on the app) so there's usually not much to do aside from setting some default value.

@Dreamescaper
Copy link
Contributor Author

Yeah, I was just surprised that that line would affect error screen.
I mean, everything else works fine for me without that line.

@Eilon
Copy link
Member

Eilon commented Nov 12, 2020

Yeah that's certainly bizarre.

@Dreamescaper
Copy link
Contributor Author

Ok, so I get this black screen when I attempt to render EditForm component (the one for Web :) ).
It obviously wasn't able to render that (fails with KeyNotFoundException), and attempts to show Error page. I don't know why it fails to display it though.

I have seen such behavior under other conditions, but can't recall anything right now.

@Dreamescaper
Copy link
Contributor Author

However I checked that it does help to BackgroundColor to white explicitly.

@Eilon
Copy link
Member

Eilon commented Nov 12, 2020

Thank you for sending the PR, it is now merged!

@Eilon Eilon added area-mobileblazorbindings Experimental Mobile Bindings for Blazor bug Something isn't working labels Nov 12, 2020
@Eilon Eilon added this to the 0.6-preview milestone Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mobileblazorbindings Experimental Mobile Bindings for Blazor bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants