Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

uwp project missing #41

Open
vscodewinodws opened this issue Jan 16, 2020 · 18 comments
Open

uwp project missing #41

vscodewinodws opened this issue Jan 16, 2020 · 18 comments
Labels
area-mobileblazorbindings Experimental Mobile Bindings for Blazor

Comments

@vscodewinodws
Copy link

by generating project described in blog
https://devblogs.microsoft.com/aspnet/mobile-blazor-bindings-experiment/

creates android and ios project missing uwp projects , why hate for windows from Microsoft ?
we need UWP app along side with this projects.

@Eilon Eilon added the area-mobileblazorbindings Experimental Mobile Bindings for Blazor label Jan 16, 2020
@Eilon
Copy link
Member

Eilon commented Jan 16, 2020

It wasn't added mostly due to time constraints. You should be able to manually add a UWP project by creating one as part of a Xamarin.Forms project, but pointing it at your shared UI project with Mobile Blazor Bindings. We will look into adding a UWP template here as well.

@Eilon
Copy link
Member

Eilon commented Jan 16, 2020

Also please note that we've never tried it, so if you do try it, please let us know if it works or if you ran into any issues.

@Knudel
Copy link

Knudel commented Jan 16, 2020

I don't know if I am doing it right, but I get an exception:

System.PlatformNotSupportedException: 'EventLog access is not supported on this platform.'

On the line:

 var host = Host.CreateDefaultBuilder()
            .ConfigureServices((hostContext, services) =>
            {
                // Register app-specific services
                //services.AddSingleton<AppState>();
            })
            .Build();

@Eilon
Copy link
Member

Eilon commented Jan 16, 2020

Oh darn. Generic Host has a few default things that don't seem to be working on iOS or UWP. I will investigate and get an answer.

@Tratcher / @glennc - do you know how I can use Generic Host, but disable certain default things, such as EventLog, file watchers for config changes, etc.?

This is how Generic Host is used in the templates:

https://github.com/xamarin/MobileBlazorBindings/blob/master/templates/MobileBlazorBindings-app/NewApp/App.cs#L12-L18

@Tratcher
Copy link
Member

@Knudel what's the stack trace for that exception?

@Eilon I expect you'll need to move from Host.CreateDefaultBuilder() to new HostBuilder() and/or provide your own platform defaults.

@Knudel
Copy link

Knudel commented Jan 16, 2020

@Tratcher new HostBuilder() did the trick, thank you.

UWP is working..

(Do you still need the stack trace?)

This exception was originally thrown at this call stack:
	System.Diagnostics.EventLog.EventLog(string, string, string)
	Microsoft.Extensions.Logging.EventLog.EventLogSettings.CreateDefaultEventLog()
	Microsoft.Extensions.Logging.EventLog.EventLogSettings.EventLog.get()
	Microsoft.Extensions.Logging.EventLog.EventLogLogger.EventLogLogger(string, Microsoft.Extensions.Logging.EventLog.EventLogSettings, Microsoft.Extensions.Logging.IExternalScopeProvider)
	Microsoft.Extensions.Logging.EventLog.EventLogLoggerProvider.CreateLogger(string)
	Microsoft.Extensions.Logging.LoggerFactory.CreateLoggers(string)
	Microsoft.Extensions.Logging.LoggerFactory.CreateLogger(string)
	System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
	Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext)

@Tratcher
Copy link
Member

Tratcher commented Jan 16, 2020

Ah, there's an isWindows check, but that's not good enough for UWP.
https://github.com/dotnet/extensions/blob/dea81ef6ca214e023f918ac32c2d9e9facf13672/src/Hosting/Hosting/src/Host.cs#L110-L114

Feel free to file an issue on that.

@vscodewinodws
Copy link
Author

there should be proper documentation how to do add uwp support in MobileBlazorBindings . there is well documented docs for xamarin forms in case uwp needs to be added later and earlier was not selected for creation , i tried to take that reference and failed seems there is difference between this and xamarin forms xaml page app

@Eilon
Copy link
Member

Eilon commented Jan 17, 2020

@vscodewinodws I'm keeping this issue to track proper UWP support.

@jamesmontemagno
Copy link
Member

@vscodewinodws
Copy link
Author

@jamesmontemagno I gone through your link I am familiar with asp.net core and Xamarin still I am not able to closely relate it how it will solve my problem I still think there should be step by step documentation which will help all developer like we have for Xamarin forms

@AutumnEvans418
Copy link

Another option is to remove the EventLog source like so in the webhost builder

.ConfigureLogging(d =>
                {
                    d.ClearProviders();
                    d.AddConsole();
                })

@freever
Copy link

freever commented Mar 12, 2020

@chrisevans9629 that works on UWP and Android but throws PlatformNotSupported on iOS :)

@freever
Copy link

freever commented Mar 12, 2020

var host = new HostBuilder() works on UWP and iOS, but not Android

@freever
Copy link

freever commented Mar 12, 2020

So it looks like there's a MobileBlazorBindingsHost that works.

@Eilon I have added a UWP project for the Hello World sample, do you want a PR? I could take a stab at the other samples too.

@AutumnEvans418
Copy link

AutumnEvans418 commented Mar 13, 2020

@freever I made a pull request for a UWP todo list sample awhile back. I need to update it to use the mobileblazorbindingsHost though:
#62

@Eilon
Copy link
Member

Eilon commented Mar 18, 2020

Thank you I will take a look! BTW sorry things have been a bit slow. I'm home with 2 kids full time due to virus lockdown and daycare not available. But I assure you that I spent what previous little time I have on Mobile Blazor Bindings!

@brunoprietog
Copy link

Hi! I am delighted with this. Is there any news?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mobileblazorbindings Experimental Mobile Bindings for Blazor
Projects
None yet
Development

No branches or pull requests

8 participants