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

net5.0+ and Skia XAML Hot Reload does not work if the solution path contains a # character #5953

Closed
3 of 20 tasks
Luk164 opened this issue May 6, 2021 · 12 comments
Closed
3 of 20 tasks
Labels
area/external Categorizes an issue or PR as being external to the Uno

Comments

@Luk164
Copy link

Luk164 commented May 6, 2021

Current behavior

I am getting a LOT of errors and warnings, even though solutions compile and run just fine.

Expected behavior

No errors/warnings.

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

  1. Create a fresh template
  2. Add this to GTK so build succeeds
<PropertyGroup>
    <UnoUIUseRoslynSourceGenerators>false</UnoUIUseRoslynSourceGenerators>
 </PropertyGroup>

  1. Main layout
This is my main layout:
 <Page
    x:Class="VentoyTool.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:VentoyTool"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    mc:Ignorable="d">

    <muxc:NavigationView x:Name="nvSample" HorizontalAlignment="Stretch">
        <muxc:NavigationView.MenuItems>
            <muxc:NavigationViewItem Icon="Play" Content="Menu Item1" Tag="SamplePage1" />
            <muxc:NavigationViewItem Icon="Save" Content="Menu Item2" Tag="SamplePage2" />
            <muxc:NavigationViewItem Icon="Refresh" Content="Menu Item3" Tag="SamplePage3" />
            <muxc:NavigationViewItem Icon="Download" Content="Menu Item4" Tag="SamplePage4" />
        </muxc:NavigationView.MenuItems>
        <Frame x:Name="contentFrame" HorizontalAlignment="Stretch"/>
    </muxc:NavigationView>

</Page>
  1. Test layout (it is loaded to Frame in main layout on construction)
This is my test layout:
 <Page
    x:Class="VentoyTool.Test"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:VentoyTool"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <TextBox Text="Test text or something" FontSize="48"/>
    </Grid>
</Page>

  1. Results into following errors/warnings:
Log:
 Severity	Code	Description	Project	File	Line	Suppression State
Warning		Found conflicts between different versions of "System.Numerics.Vectors" that could not be resolved.
There was a conflict between "System.Numerics.Vectors, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
    "System.Numerics.Vectors, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
    References which depend on "System.Numerics.Vectors, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Numerics.Vectors.dll].
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Numerics.Vectors.dll
          Project file item includes which caused reference "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Numerics.Vectors.dll".
            System.Numerics.Vectors
    References which depend on "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [].
        C:\Users\lukij\.nuget\packages\system.text.json\5.0.0\lib\netstandard2.0\System.Text.Json.dll
          Project file item includes which caused reference "C:\Users\lukij\.nuget\packages\system.text.json\5.0.0\lib\netstandard2.0\System.Text.Json.dll".
            C:\Users\lukij\.nuget\packages\system.text.json\5.0.0\lib\netstandard2.0\System.Text.Json.dll
            C:\Users\lukij\.nuget\packages\microsoft.extensions.logging.console\5.0.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Console.dll	VentoyTool.Droid			
Error	CS1061	'Test' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'Test' could be found (are you missing a using directive or an assembly reference?)	VentoyTool.Droid, VentoyTool.Skia.Gtk, VentoyTool.Skia.Tizen, VentoyTool.Skia.Wpf, VentoyTool.Wasm, VentoyTool.iOS, VentoyTool.macOS	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Shared\Test.xaml.cs	27	Active
Error	CS0103	The name 'contentFrame' does not exist in the current context	VentoyTool.Skia.Tizen, VentoyTool.Skia.Wpf, VentoyTool.Wasm, VentoyTool.iOS, VentoyTool.macOS	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Shared\MainPage.xaml.cs	29	Active
Error	XDG0062	Type Microsoft.UI.Xaml.Controls.NavigationView cannot be created in XAML. Building the project may help.	VentoyTool.UWP	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Shared\MainPage.xaml	11	
Error	XDG0062	Type Microsoft.UI.Xaml.Controls.NavigationViewItem cannot be created in XAML. Building the project may help.	VentoyTool.UWP	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Shared\MainPage.xaml	13	
Error	XDG0062	Type Microsoft.UI.Xaml.Controls.NavigationViewItem cannot be created in XAML. Building the project may help.	VentoyTool.UWP	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Shared\MainPage.xaml	14	
Error	XDG0062	Type Microsoft.UI.Xaml.Controls.NavigationViewItem cannot be created in XAML. Building the project may help.	VentoyTool.UWP	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Shared\MainPage.xaml	15	
Error	XDG0062	Type Microsoft.UI.Xaml.Controls.NavigationViewItem cannot be created in XAML. Building the project may help.	VentoyTool.UWP	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Shared\MainPage.xaml	16	
Error	CS1061	'MainPage' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'MainPage' could be found (are you missing a using directive or an assembly reference?)	VentoyTool.iOS, VentoyTool.macOS	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Shared\MainPage.xaml.cs	27	Active
Warning	CS8785	Generator 'XamlCodeGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentException' with message 'The path is not of a legal form.'	VentoyTool.UWP	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.UWP\CSC	1	Active
Warning		PRI257: 0xdef00522 - Resources found for language(s) 'en' but no resources found for default language(s): 'en-US'. Change the default language or qualify resources with the default language. http://go.microsoft.com/fwlink/?LinkId=231899	VentoyTool.UWP	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.UWP\GENERATEPROJECTPRIFILE		
Warning	NU1701	Package 'SkiaSharp.Views 2.80.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.	VentoyTool.Skia.Wpf.Host	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Skia.Wpf.Host\VentoyTool.Skia.Wpf.Host.csproj	1	
Warning	NU1701	Package 'SkiaSharp.Views 2.80.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.	VentoyTool.Skia.Gtk	D:\User_files\Projekty\C#\Uno\VentoyTool\VentoyTool\VentoyTool.Skia.Gtk\VentoyTool.Skia.Gtk.csproj	1	

Environment

Nuget Package:

  • [ 3.7.3 ] Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • [ N/A ] Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • [ N/A ] Uno.SourceGenerationTasks
  • [ 3.7.3 ] Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other: Just whatever template provided (I updated WASM nugets, but I did not notice any significant change)

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

IDE:

  • Visual Studio 2017 (version: )
  • Visual Studio 2019 (version: 16.9.4)
  • Visual Studio for Mac (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )
  • Visual Studio Code (version: )

Relevant plugins:

  • Resharper (version: 2021.1.2)

Anything else we need to know?

I disabled solution wide analysis on ReSharper. It is a bit frustrating because I really love the idea of the UNO platform, but at the same time it is incredibly difficult to just get an empty template that does not throw warnings and errors at every step, with or without ReSharper.

@Luk164 Luk164 added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels May 6, 2021
@jeromelaban
Copy link
Member

Thanks for the report!

A few questions:

  • What's happening when building without <UnoUIUseRoslynSourceGenerators>false</UnoUIUseRoslynSourceGenerators> ?
  • Do you have other projects in the solution, or just the GTK ones?

@jeromelaban jeromelaban added the triage/needs-information Indicates an issue needs more information in order to work on it. label May 7, 2021
@Luk164
Copy link
Author

Luk164 commented May 7, 2021

@jeromelaban

  1. It does not build at all, the problem was already mentioned in Trouble getting rid of build errors and warnings in template #5468
  2. Yes, Android, IOS, Mac, WPF, and more. Everything the template plugin generates is present.

@no-response no-response bot removed the triage/needs-information Indicates an issue needs more information in order to work on it. label May 7, 2021
@jeromelaban
Copy link
Member

Thanks for the update.

For 1., are you still getting the error of #5468 even with Uno 3.7 ?

For the errors you're seeing in 2. , the only way to get rid of those is to build all projects once, close visual studio and open it again. It's a Visual Studio issue we have no control over, but we expect that .NET 6 will reduce the errors significantly.

@Luk164
Copy link
Author

Luk164 commented May 10, 2021

@jeromelaban

  1. Screenshots are worth a 1000 words right?
    image
    image

  2. They seem to have persisted with restarts but disappeared when I manually wiped the cache. Also unrelated but ReSharper seems to get a stroke anytime I use UNO. Support ticket exists but it does not look like they are putting much effort into it. Did anyone think about creating a 3rd party plugin for resharper?

@jeromelaban
Copy link
Member

jeromelaban commented May 10, 2021

Thanks for the update.

  1. Does the build error happen when disabling resharper (particularly their custom build tooling ?), and does the error happen when building on the CLI with dotnet new ? If so can you run dotnet build /bl and post the msbuild.binlog file ?
  2. We have not considered creating a resharper plugin yet.

@Luk164
Copy link
Author

Luk164 commented May 10, 2021

@jeromelaban The resharper builder was already disabled, I only use it rarely anyway. I am not very experienced with dotnet CLI so just to make sure I do not mess up can you please post full commands for me to try out?

Regarding the ReSharper, should I add a feature ticket, or is it too expensive to even consider?

@jeromelaban
Copy link
Member

Apologies for the command line mistake I fixed it above, but basically, using a command prompt:

cd myApp\myApp.Wasm
dotnet build /bl

This will create a msbuild.binlog file that you can post here (zipped).

@Luk164
Copy link
Author

Luk164 commented May 10, 2021

@jeromelaban Here are the logs, 0 errors for both WASM and GTK. 2 errors for GTK with that property group commented out.
logs.zip

@jeromelaban
Copy link
Member

Thanks for the reports. I've found the issue here, and it's unfortunately related to this Roslyn issue dotnet/roslyn#44596, and is caused by the folder name of your solution (it contains C# in the path). #5978 will work around it in Uno, but it will prevent hotreload from working properly until the path keeps containing a #.

@jeromelaban jeromelaban changed the title False positive warnings and errors on minimally modified template XAML Hot Reload does not work if the solution path contains a # character May 13, 2021
@jeromelaban jeromelaban changed the title XAML Hot Reload does not work if the solution path contains a # character net5.0 and Skia XAML Hot Reload does not work if the solution path contains a # character May 13, 2021
@jeromelaban jeromelaban changed the title net5.0 and Skia XAML Hot Reload does not work if the solution path contains a # character net5.0+ and Skia XAML Hot Reload does not work if the solution path contains a # character May 13, 2021
@jeromelaban jeromelaban added area/external Categorizes an issue or PR as being external to the Uno and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels May 13, 2021
@jeromelaban jeromelaban mentioned this issue May 13, 2021
6 tasks
@Luk164
Copy link
Author

Luk164 commented May 13, 2021

@jeromelaban Ok, for now I just renamed my projects folder to CSharp, hopefully that will break only some of my projects...
Maybe I will add a C# folder with a symlink to CSharp.

@Youssef1313
Copy link
Member

@jeromelaban I don't think we can do anything here. Should we close?

@jeromelaban
Copy link
Member

Indeed, we cannot do anything we'll have to wait for roslyn updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/external Categorizes an issue or PR as being external to the Uno
Projects
None yet
Development

No branches or pull requests

3 participants