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

[Bug] VS For Mac 8.9 Preview 4 broke hot reload #13721

Closed
Tommigun1980 opened this issue Feb 10, 2021 · 24 comments
Closed

[Bug] VS For Mac 8.9 Preview 4 broke hot reload #13721

Tommigun1980 opened this issue Feb 10, 2021 · 24 comments
Labels
external-hotreload Non-Forms bugs that affect Hot Reload external-vs s/unverified New report that has yet to be verified t/bug 🐛

Comments

@Tommigun1980
Copy link

Tommigun1980 commented Feb 10, 2021

Description

Steps to Reproduce

I am not sure whether this report should be a Visual Studio report or a Xamarin.Forms report. Please let me know if this report is filed in an incorrect place!

  1. Download VS For Mac 8.10
  2. Add the Xamarin.Forms Community toolkit NuGet
  3. Reference a RangeSlider inside it, for example:
<ContentPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
    ...
    >
    <ContentPage.Content>
        <xct:RangeSlider x:Name="SomeRangeSlider" />
    </ContentPage.Content>
</ContentPage>
  1. Please note that the RangeSlider element must have an 'x:Name' property for the error to happen.
  2. Build and run to launch the iOS simulator
  3. Make an XAML change to invoke hot-reload
  4. Note: It is not even necessary to edit the view that contains the RangeSlider element --- if any XAML file in your project has a RangeSlider element (that contains an x:Name attribute) hot reload will fail.

NOTE!! If instead of using the recommended xmlns:xct="http://xamarin.com/schemas/2020/toolkit" notation the "old school" variant xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit" is used, then the problem goes away.

Expected Behavior

The hot reload change should be made visible.

Actual Behavior

Hot-reload compilation fails with:

Views/MyPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "RangeSlider".
    0 Warning(s)
    1 Error(s)

Basic Information

  • Version with issue: VS 8.9 Preview 4, XF 5.0.0.1931, XF Community Toolkit 1.0.2, and later versions of all
  • Last known good version: Possibly VS 8.9 Preview 3, maybe none
  • Platform Target Frameworks:
    • iOS: 14.5

Environment

Show/Hide Visual Studio info
=== Visual Studio Community 2019 for Mac (Preview) ===

Version 8.9 Preview (8.9 build 1582)
Installation UUID: 67acd4c8-3ac2-4ae0-a8c9-d2143007c264
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

	Package version: 612000113

=== Mono Framework MDK ===

Runtime:
	Mono 6.12.0.113 (2020-02/4fdfb5b1fd5) (64-bit)
	Package version: 612000113

=== Roslyn (Language Service) ===

3.9.0-4.21104.8+2fc92d84e746c3aab75f0930278ea6675cd5bb5c

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.103/Sdks
SDK Versions:
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.406
	3.1.405
	3.1.404
	3.1.403
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	3.1.12
	3.1.11
	3.1.10
	3.1.9

=== .NET Core 3.1 SDK ===

SDK: 3.1.406

=== Xamarin.Profiler ===

Version: 1.6.15.68
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 11.2.0.0 (Visual Studio Community)
Commit: xamarin-android/d16-9/f908d16
Android SDK: /Users/tommikiviniemi/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		None installed

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.4
SDK Build Tools Version: 30.0.2

Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@1d382be
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.32.2@cfe06e0
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@ad80a42

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/tommikiviniemi/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.9.0.21
Hash: 57e40ba
Branch: remotes/origin/main
Build date: 2021-01-08 01:57:14 UTC

=== Android Device Manager ===

Version: 16.9.0.14
Hash: 0fdccda
Branch: remotes/origin/main
Build date: 2021-01-08 01:57:36 UTC

=== Apple Developer Tools ===

Xcode 12.4 (17801)
Build 12D4e

=== Xamarin.Mac ===

Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

=== Xamarin.iOS ===

Version: 14.14.1.0 (Visual Studio Community)
Hash: 17845a189
Branch: d16-9
Build date: 2021-01-26 03:42:38-0500

=== Xamarin Designer ===

Version: 16.9.0.309
Hash: 9a5259fb5
Branch: remotes/origin/9a5259fb55e54a445c145ab5ea29c04a418deed2
Build date: 2021-02-04 09:34:28 UTC

=== Build Information ===

Release ID: 809001582
Git revision: b0620b767dbf9f79bbacc2053ae155a66f147e04
Build date: 2021-02-04 12:13:43-05
Build branch: release-8.9
Xamarin extensions: b0620b767dbf9f79bbacc2053ae155a66f147e04

=== Operating System ===

Mac OS X 10.16.0
Darwin 20.3.0 Darwin Kernel Version 20.3.0
    Thu Jan 21 00:07:06 PST 2021
    root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

Build Logs

Running generator 'MSBuild:UpdateDesignTimeXaml' on file '/Users/myname/Projects/myproject/Project/Views/MyPage.xaml'...
Build started 2/10/2021 5:46:56 PM.
__________________________________________________
Project "/Users/myname/Projects/myproject/Project/MyProject.csproj" (UpdateDesignTimeXaml target(s)):

Target XamlG:
    Generating code behind for XAML files
    Views/MyPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "RangeSlider".
Done building target "XamlG" in project "MyProject.csproj" -- FAILED.

Done building project "MyProject.csproj" -- FAILED.

Build FAILED.

Views/MyPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "RangeSlider".
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.17

Errors in file generation.

Reproduction Link

HotReloadBroke.zip

VS bug #1277379

@Tommigun1980 Tommigun1980 added s/unverified New report that has yet to be verified t/bug 🐛 labels Feb 10, 2021
@jsuarezruiz
Copy link
Contributor

Could you attach a sample where reproduce the issue?
Happens with any CustomView?

@jsuarezruiz jsuarezruiz added external-vs external-hotreload Non-Forms bugs that affect Hot Reload s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels Feb 10, 2021
@Tommigun1980
Copy link
Author

Tommigun1980 commented Feb 10, 2021

Could you attach a sample where reproduce the issue?
Happens with any CustomView?

@jsuarezruiz
It happens if you have an XAML file with a RangeSlider in your project (it doesn't even need to be the view that is currently hot edited). So the mere presence of a single <RangeSlider x:Name="Whatever" /> element in any of your XAML files will break hot reload with VS 8.9 Preview 4.

The only requirement is that the RangeSlider element must have an 'x:Name' attribute for the error to happen.

I uploaded a repro project and updated the report to reflect the necessity for the 'x:Name' property to exist for the error to happen.

@jtorvald
Copy link
Contributor

I experience a similar issue in my project with some random components:
Error: : XamlC error XFC0000 : Cannot resolve type "HorizontalListView"
Error: : XamlC error XFC0000 : Cannot resolve type "Expander" (from Xamarin Community Toolkit)

This seems to be a reappearance of #11101

I removed the x:Name attributes in my application but that didn't have any positive result.

Xamarin Forms: 5.0.0.1931

=== Visual Studio Community 2019 for Mac ===

Version 8.8.8 (build 12)
Installation UUID: fe6a8972-34d3-4fc9-af50-b53536f7d1c8
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

	Package version: 612000113

=== Mono Framework MDK ===

Runtime:
	Mono 6.12.0.113 (2020-02/4fdfb5b1fd5) (64-bit)
	Package version: 612000113

=== Roslyn (Language Service) ===

3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.103/Sdks
SDK Versions:
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.406
	3.1.405
	3.1.404
	3.1.403
	3.1.402
	3.1.401
	3.1.302
	3.1.301
	3.1.300
	3.1.202
	3.1.200
	3.1.102
	3.1.101
	3.1.100
	3.0.101
	3.0.100
	3.0.100-rc1-014190
	2.2.402
	2.1.701
	2.1.700
	2.1.505
	2.1.504
	2.1.302
	2.1.4
	2.0.0
	1.0.4
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	3.1.12
	3.1.11
	3.1.10
	3.1.9
	3.1.8
	3.1.7
	3.1.6
	3.1.5
	3.1.4
	3.1.2
	3.1.1
	3.1.0
	3.0.1
	3.0.0
	3.0.0-rc1-19456-20
	2.2.7
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16
	2.1.15
	2.1.14
	2.1.13
	2.1.12
	2.1.11
	2.1.9
	2.1.8
	2.1.2
	2.0.5
	2.0.0
	1.1.2
	1.0.5

=== .NET Core 3.1 SDK ===

SDK: 3.1.406

=== Xamarin.Profiler ===

Version: 1.6.13.11
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 11.1.0.26 (Visual Studio Community)
Commit: xamarin-android/d16-8/a36ce73
Android SDK: /Users/developer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		8.0 (API level 26)
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.5
SDK Build Tools Version: 29.0.2

Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-8@79d9533
ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
SQLite: xamarin/sqlite/3.32.1@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/developer/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.8.0.32
Hash: 01a7774
Branch: remotes/origin/d16-8
Build date: 2021-01-14 00:34:58 UTC

=== Android Device Manager ===

Version: 16.8.0.46
Hash: 0a81419
Branch: remotes/origin/d16-8
Build date: 2021-01-14 00:35:22 UTC

=== Xamarin Designer ===

Version: 16.8.0.510
Hash: 44e3f3ce9
Branch: remotes/origin/d16-8
Build date: 2020-12-10 00:06:14 UTC

=== Apple Developer Tools ===

Xcode 12.4 (17801)
Build 12D4e

=== Xamarin.Mac ===

Version: 7.4.0.4 (Visual Studio Community)
Hash: 5a05865f6
Branch: xcode12.4
Build date: 2021-01-28 02:30:22-0500

=== Xamarin.iOS ===

Version: 14.10.0.4 (Visual Studio Community)
Hash: 5a05865f6
Branch: xcode12.4
Build date: 2021-01-28 02:30:23-0500

=== Build Information ===

Release ID: 808080012
Git revision: 147eee6fcc43c486d8b79477b6a521322a015604
Build date: 2021-02-04 04:32:34-05
Build branch: release-8.8
Xamarin extensions: 147eee6fcc43c486d8b79477b6a521322a015604

=== Operating System ===

Mac OS X 10.16.0
Darwin 20.3.0 Darwin Kernel Version 20.3.0
    Thu Jan 21 00:07:06 PST 2021
    root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

DeepClean 1.2.5
FileNesting 0.1.2


@Tommigun1980
Copy link
Author

Could the needs repro tag be removed?

@Redth Redth removed s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels Mar 4, 2021
@nor0x
Copy link
Contributor

nor0x commented Apr 1, 2021

Still seeing this issue in Visual Studio for Mac 8.9.4 (stable), when using some custom or third-party components. The project builds and deploys fine with such issues - but hot-reload is completely broken.

Error:  : XamlC error XFC0000 : Cannot resolve type "TabHostView".
Error:  : XamlC error XFC0000 : Cannot resolve type "PrismApplication".
Error:  : XamlC error XFC0000 : Cannot resolve type "MaterialFrame".
Show/Hide Visual Studio info
Visual Studio Community 2019 for Mac
Version 8.9.4 (build 25)
Installation UUID: 9dd08f48-9ac3-4348-807d-2e7dc45c0a86
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

	Package version: 612000125

Mono Framework MDK
Runtime:
	Mono 6.12.0.125 (2020-02/8c552e98bd6) (64-bit)
	Package version: 612000125

Roslyn (Language Service)
3.9.0-6.21152.10+c10f884b30737542ddd84ca889a4aad9281ce210

NuGet
Version: 5.8.0.6860

.NET Core SDK
SDK: /usr/local/share/dotnet/sdk/5.0.201/Sdks
SDK Versions:
	5.0.201
	5.0.103
	5.0.102
	3.1.407
	3.1.406
	3.1.405
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

.NET Core Runtime
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	5.0.4
	5.0.3
	5.0.2
	3.1.13
	3.1.12
	3.1.11

.NET Core 3.1 SDK
SDK: 3.1.407

Xamarin.Profiler
Version: 1.6.15.68
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin Designer
Version: 16.9.0.316
Hash: 2241b204a
Branch: tags/vsm-rel/d16.9-4540908
Build date: 2021-03-10 21:18:10 UTC

Apple Developer Tools
Xcode 12.4 (17801)
Build 12D4e

Xamarin.Mac
Version: 7.8.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:43-0500

Xamarin.iOS
Version: 14.14.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:44-0500

Xamarin.Android
Version: 11.2.2.1 (Visual Studio Community)
Commit: xamarin-android/d16-9/877f572
Android SDK: /Users/johnny/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		7.0 (API level 24)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.4
SDK Build Tools Version: 29.0.2

Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@54f8c24
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.34.1@daff8f4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@d210f11

Microsoft OpenJDK for Mobile
Java SDK: /Users/johnny/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 16.9.0.22
Hash: a391de2
Branch: remotes/origin/d16-9~2
Build date: 2021-03-24 08:30:26 UTC

Android Device Manager
Version: 16.9.0.17
Hash: fc2b3db
Branch: remotes/origin/dev/jmt/d16-9bump~1
Build date: 2021-03-24 08:30:44 UTC

Build Information
Release ID: 809040025
Git revision: 5d0f80a4343884101c6c7869bc61d5101cf30052
Build date: 2021-03-25 08:43:13-04
Build branch: release-8.9
Xamarin extensions: 5d0f80a4343884101c6c7869bc61d5101cf30052

Operating System
Mac OS X 10.16.0
Darwin 20.3.0 Darwin Kernel Version 20.3.0
    Thu Jan 21 00:07:06 PST 2021
    root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

@Tommigun1980
Copy link
Author

Same here. I have to reload Visual Studio if I make edits in case I use components such as the RangeSlider from the Xamarin Community Toolkit.

Has hot reload been deprecated?

@Tommigun1980
Copy link
Author

Tommigun1980 commented Jun 9, 2021

Hello?

Here is a screenshot of what happens every time an XAML file is changed:
Screenshot 2021-06-09 at 14 35 01

RangeSlider is a part of the Xamarin.CommunityToolkit package.

Any chance hot reload could be fixed? It is very hard to use the current version of Visual Studio for Mac/Xamarin.Forms as some core features are broken, and all focus seems to be on new versions.

We rely on these tools so any chance these could be fixed? Please!!

@jsuarezruiz Tagging you, maybe you can help? This still happens with the latest version of VS For Mac and latest version of Xamarin.Forms. Thanks.

@Tommigun1980
Copy link
Author

Refresher.

What causes the problem: #13721 (comment)
Reproduction project: https://github.com/xamarin/Xamarin.Forms/files/5959715/HotReloadBroke.zip

@jtorvald
Copy link
Contributor

jtorvald commented Jun 9, 2021

@Tommigun1980 if you go to preferences -> tools -> hot reload and set hot reload to Full Page, it will work. I've the same errors and hot reload works for me.

I do agree that there is a lot of focus on the new version and that it seems to be obstructing bugfixes/releases on production code, which is a bit annoying. Hope it's worth it.

@jsuarezruiz
Copy link
Contributor

@Tommigun1980 Could you attach an example where reproduce the issue?, just a Xamarin.Forms project adding a RangeSlider (or any control from the XCT)?
cc @StephaneDelcroix

@Tommigun1980
Copy link
Author

Tommigun1980 commented Jun 9, 2021

@jsuarezruiz This bug report does have a repro sample I made four months ago. Other people in this thread have reported that it's not specific to the RangeSlider (#13721 (comment)), but that other third party controls incur the same problem. I have personally only seen it with the RangeSlider as it's the only third party control of the sort I am using, so I can only verify that at least that one breaks hot reload. My repro project is literally just a RangeSlider (with an x:Name attribute as it seems to be required to incur the error).

Furthermore, the page that is being reloaded doesn't even need to have a RangeSlider on it. It's enough if it exists anywhere in the project for hot reload to stop working.

@jtorvald Thank you for the suggestion, but unfortunately it doesn't help. In fact it introduces a third error when enabling full page refresh ("Object reference not set to an instance of an object", at line -1):
Screenshot 2021-06-09 at 14 45 50

@Tommigun1980
Copy link
Author

I've been without hot reload for several months now and have pretty much stopped updating UIs until this is fixed. It is just too slow to iterate on anything without it unfortunately.

@jtorvald
Copy link
Contributor

jtorvald commented Jun 9, 2021

@jsuarezruiz I've these errors as well, also the Expander from XCT. I thought that it was about the x:Name being set. But in this example the Hot reload per item also doesn't work for me without the x:Name. Even with an xct:Expander the hot reload per item does not work if I change the text on the label.

That being said; The hot reload per page works for me, also with the example above. @Tommigun1980 are you sure you tested it by stopping the debugging, changing the preference and re-deployed to the simulator? Because if I just change the preference while debugging it does not work. But with a new deploy it does with your sample project.

@Tommigun1980
Copy link
Author

Tommigun1980 commented Jun 9, 2021

@jtorvald In my repro project the error only showed up when x:Name was added to the RangeSlider. You can verify this by downloading it and removing the attribute, at which point hot reload does start to work. I am also using the xct:Expander component in my project, but because it lacks an x:Name attribute it doesn't break hot reload.

I am also sure I stopped the simulator after turning on full page refresh, and I even restarted VS For Mac to be sure. After restart I only get the two errors with hot reload, ie the ones where it complains about RangeSlider not being resolved.

I have a suspicion this may be related to how the external library is referenced. Xamarin.CommunityToolkit changed their recommendation that it should be referenced via the xmlns:xct="http://xamarin.com/schemas/2020/toolkit" notation. I have only seen the error happen when libraries are referenced that way, but this is unsubstantiated and unverified if it actually does affect.
[Edit: Verified that this is indeed the root cause]

@jtorvald
Copy link
Contributor

jtorvald commented Jun 9, 2021

@Tommigun1980 yeah I'm not saying that you're lying ;-) I noticed exactly the same what you wrote above. With the x:Name. That's what I've in my other project as well. I'm currently updating VS and will test this again with your sample project after the restart. I will also try to figure out if it's caused by the url namespace.

@Tommigun1980
Copy link
Author

@jtorvald I wasn't implying you were saying that, I just stated what I had been able to verify. Thank you so much for looking into this with me!! Let's get this to work.

@Tommigun1980
Copy link
Author

Tommigun1980 commented Jun 9, 2021

@jsuarezruiz It should probably be mentioned that these errors:
121347495-ed7d7480-c92f-11eb-98ff-f2b929e42ce3
...also show up in the build log when building and launching the application. However, the application boots fine and the changes are reflected in the app.

If the changes are done while the app is running, though, the same errors prevent hot reload from working.
So the incorrect errors are not isolated to hot reload only, but only seem to affect its functionality.

@jtorvald
Copy link
Contributor

jtorvald commented Jun 9, 2021

@jsuarezruiz @Tommigun1980

I tested it with the most recent (stable) version of visual studio.
Note: that the sample solution has an old Xamarin.Forms library that does not fully support hot reload.
When testing: make sure after removing the x:Name to clean the whole solution and restart visual studio (maybe even removing bin/obj folders). I repeatedly had it fail without x:Name after it failed with x:Name before. After clean, restart VS and rebuild it worked. (even hot reload per item)

Results below:

Versions:

8.10 build 1773
Mono 6.12.0.140 (2020-02/51d876a041e) (64-bit)
Roslyn 3.10.0-3.21251.8+4c32f5e4e9c0828a94fd4d1c9c0994082c85aaf3
iOS Version: 14.20.0.1 (Visual Studio Enterprise)
Hash: fe0e2c518
Branch: d16-10
Build date: 2021-05-19 08:15:56-0400

-= XCT with URL namespace =-

The above sample solution has an old version. VS also warns that Hot reload needs 5.0.0.2012 to work.

Xamarin Forms 5.0.0.1931
Xamarin Community Toolkit 1.0.2

x:Name:
Full page: working
Changes only: not working (needs 5.0.0.2012 says VS)

Without x:Name:
Full page: working
Changes only: (needs 5.0.0.2012 says VS)

-= XCT with URL namespace =-

Xamarin Forms 5.0.0.2012
Xamarin Community Toolkit 1.1.0

With x:Name:
Full page: not working
Changes only: not working

WITHOUT x:Name: (needs clean all and re-open solution)
Full page: working
Changes only: working

-= XCT WITHOUT URL namespace =-

Not possible in XAML?

@Tommigun1980
Copy link
Author

@jtorvald Thank you for the testing!

So the conclusion is that with the latest XF version (5.0.0.2012) neither full page or changes only work, and that the error goes away if the "x:Name" attribute is removed (once the solution is cleaned and re-opened), right?

That is 100% consistent with my findings if I understood it correctly. Great find that you have to restart VS (and possibly delete obj and bin folders) for the changes to take place.


@jsuarezruiz As @jtorvald said, my repro project has by now an outdated Xamarin.Forms version so please update it to the latest version before running the repro sample.


Also fwiw I have also encountered issues where I have to delete the obj and bin folders before some issues go away. This seems to also only happen with newer versions of VS For Mac. It'd be great if this wasn't required as you never know when it's needed, and it's time consuming to constantly be deleting them just to be sure. As an example I was trying to isolate a regression with a new version of the Microsoft SignalR library so I was jumping between different NuGet versions of its packages, but the changes took place only after deleting bin and obj folders (cleaning solution wasn't enough). The tools are currently regressing at quite a high rate and that's never good.

@Tommigun1980
Copy link
Author

@jtorvald @jsuarezruiz @StephaneDelcroix
I verified that the problem goes away if, instead of using the recommended xmlns:xct="http://xamarin.com/schemas/2020/toolkit" notation the "old school" variant xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit" is used instead.

The latter notation makes the problem go away. Could this please be fixed? Microsoft itself recommends to use the broken annotation.

Or is this a Xamarin.CommunityToolkit issue and not related to hot reload?

@jtorvald
Copy link
Contributor

jtorvald commented Jun 9, 2021

@Tommigun1980 of course. I didn't find the correct namespace before. With the one you provided, it works. See results below. Please note that I really need to do a full restart of VS and clean bin/obj and clean the solution before I get reproducible results. Otherwise it can still happen that it works (with x:name) or doesn't work (without x:name) based on the previous test case.

-= XCT WITHOUT URL namespace =-

Xamarin Forms 5.0.0.2012
Xamarin Community Toolkit 1.1.0

With x:Name: (needs clean all, remove bin/obj and restart VS)
Full page: working
Changes only: working

WITHOUT x:Name: (needs clean all, remove bin/obj and restart VS)
Full page: working
Changes only: working

--
note: after adding the URL namespace back in, clean, remove bin/obj, restart VS. Same problems as before.

@Tommigun1980
Copy link
Author

Tommigun1980 commented Jun 9, 2021

@jtorvald Thank you for also verifying this! I really appreciate it. Hopefully the good guys can fix the issue soon.

I updated the report with the additional details.

@jtorvald
Copy link
Contributor

jtorvald commented Jun 9, 2021

@Tommigun1980 same results posted in the same minute 🥇 thanks for suggesting the old-skool namespace. That helps me with my projects for the time being.

@jfversluis
Copy link
Member

This is quite old by now and hopefully fixed in newer versions. If not, please report the issue through the Visual Studio Help menu. That will include all the necessary logs and should make this land with the appropriate team. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
external-hotreload Non-Forms bugs that affect Hot Reload external-vs s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

6 participants