unoplatform / uno.xamlmerge.task

https://platform.uno/
Other
7 stars 4 forks source link

[Android/iOS] Cannot locate MergedResourcesDictionnary.xaml with latest dev uno.ui on project with pages on UWP head #90

Closed takla21 closed 1 year ago

takla21 commented 1 year ago

Current behavior

It doesn't localize MergedResourcesDictionnary.xaml. Which makes the app crash. image

Expected behavior

It should be able to find the MergedResourcesDictionnary.xaml. It works still when using an older uno.ui package version (e.g 4.4.20).

Screenshot_20221021-170916

How to reproduce it (as minimally and precisely as possible)

Environment

Nuget Package:

Package Version(s): uno.ui: 4.6.0-dev.888 uno.xamlmerge.ui: 1.1.0-dev.13

Affected platform(s):

Visual Studio:

Relevant plugins:

Anything else we need to know?

jeromelaban commented 1 year ago

@takla21 the original project solution is built to avoid the reuse of files this way (this is not needed anymore), changing files location is likely to cause this issue.

takla21 commented 1 year ago

@jeromelaban right, I did validated on my side that the bug does not happen when starting directly from the app template (shared project). The problem here, as mentioned in the OP, is that we have to put the .xaml file in order to keep the UWP hotreload on more complex project. So we're restricted to this structure until it's fixed (or move our project into WinUI maybe?).

jeromelaban commented 1 year ago

Got it. Know that this is fixed in VS since 17.2, so you should be good to go. Still, we'll take a look.

jeromelaban commented 1 year ago

Fixed in Uno.XamlMerge.Task 1.14.0-dev.14.

takla21 commented 1 year ago

Unfortunately, the bug still happens on 1.14.0-dev.14. I've updated the sample with the latest uno.xamlmerge version and also latest uno dev (except for iOS, see unoplatform/uno#10547)

MergeDictionnaries_update.zip

Note: this also keeps popping when using this version of uno.xamlmerge image

EDIT: New issue opened for iOS.

takla21 commented 1 year ago

I've attempted to debug the vs prompt mentionned in my other comment (by pressing ok). Essentially, it thrown this

image

jeromelaban commented 1 year ago

This looks unrelated. Make sure to restart visual studio once you've updated the package.

jeromelaban commented 1 year ago

Ah no, it's missing break, I'll remove the change, apologies about the delay.

jeromelaban commented 1 year ago

@takla21 1.15.0-dev.15 contains the proper fixes. Let me know if it helps, thanks!

takla21 commented 1 year ago

@jeromelaban So the good news is that it works on iOS. Unfortunately, it's still the same issue on android. Although the visual studio prompt is not shown anymore.

I've updated the sample again with 1.15.0-dev.15 here MergeDictionnaries_1.15.0-dev.15.zip

I've generated a binlog for android. hopefully it can help msbuild.zip

jeromelaban commented 1 year ago

Ah I see, the build was not the right one... it's in 1.16.0-dev.16 that should be used.

That being said, all this happened because Xamarin projects by default use Uno.SourceGenerationTasks, and if you set the <UnoUIUseRoslynSourceGenerators>true</UnoUIUseRoslynSourceGenerators> it will use Roslyn instead and build a lot faster. This is enabled by default for net6+ projects.

If you can use this if your build agents are running msbuild 17.0 or later.

takla21 commented 1 year ago

Now, it's working on all platforms. I'll also take a look to the suggestion to use UnoUIUseRoslynSourceGenerators as we're definitely using msbuild 17.0 on our pipelines.

Thanks!