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

Intellisense not recognizing xaml x:Name attribute as property #4654

Closed
21 tasks
Greg-Freeman opened this issue Dec 3, 2020 · 3 comments
Closed
21 tasks

Intellisense not recognizing xaml x:Name attribute as property #4654

Greg-Freeman opened this issue Dec 3, 2020 · 3 comments
Labels
area/external Categorizes an issue or PR as being external to the Uno kind/bug Something isn't working

Comments

@Greg-Freeman
Copy link

Greg-Freeman commented Dec 3, 2020

Current behavior

When I created the project from the Uno Platform Solutions Template in Visual Studio on Windows, adding the x:Name attribute to elements in the XAML was not detected by Intellisense in the code behind.

Expected behavior

Intellisense detects x:Name attributes in the code behind as properties on the class

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

I had this issue from the start after creating the solution from Uno Platform Solutions Template, but have since resolved it, so I no longer have the example. Mostly I am posting the workaround below as documentation for others that may run into this, as I have seen other bug reports with people having this issue.

Workaround

After a lot of googling, I found some others had a similar issue on this thread.

The solution that ended up working for me was to delete the MainForm.xaml file in the shared project and recreate it under the UWP project. I then moved the file from the UWP project back into the shared project and everything started working. I tried all the steps suggested in the Getting Started tutorial and none worked.

Environment

Nuget Package:

  • [x ] Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • Uno.SourceGenerationTasks
  • Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other:

Nuget Package Version(s):
PM> Get-Package | Select-Object Id, Version | Where-Object {$_.Id -like "uno*"}

Id Version


Uno.UI.RemoteControl 3.3.0
Uno.Wasm.Bootstrap 1.3.4
Uno.Wasm.Bootstrap.DevServer 1.3.4
Uno.UI 3.3.0
Uno.UI.WebAssembly 3.3.0
Uno.UI.RemoteControl 3.3.0
Uno.UI.Skia.Tizen 3.3.0
Uno.UI 3.3.0
Uno.UI.RemoteControl 3.3.0
Uno.UI 3.3.0
Uno.UI.Skia.Wpf 3.3.0
Uno.UI.RemoteControl 3.3.0
Uno.UI 3.3.0
Uno.UI.Skia.Wpf 3.3.0
Uno.UI 3.3.0
Uno.UI.RemoteControl 3.3.0
Uno.Core 2.0.0
Uno.UI 3.3.0
Uno.UI 3.3.0
Uno.UI.RemoteControl 3.3.0
Uno.UI 3.3.0
Uno.UI.RemoteControl 3.3.0
Uno.UniversalImageLoader 1.9.33

Affected platform(s):

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

IDE:

  • Visual Studio 2017 (version: )
  • [x ] Visual Studio 2019 (version: 16.8.2)
  • Visual Studio for Mac (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )
  • Visual Studio Code (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

@Greg-Freeman Greg-Freeman added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Dec 3, 2020
@jeromelaban
Copy link
Member

jeromelaban commented Dec 3, 2020

Thank you for the report. This is a visual studio issue, for which the resolution can be found here: https://github.com/unoplatform/uno/blob/master/doc/articles/get-started-wizard.md#initializecomponent-or-xname-variable-is-not-available-in-code-behind

You can follow the other known issues in this document, and in the global list of issues we're tracking: #982.

GitHub
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported. - unoplatform/uno

@jeromelaban jeromelaban added area/external Categorizes an issue or PR as being external to the Uno and removed triage/untriaged Indicates an issue requires triaging or verification labels Dec 3, 2020
@Greg-Freeman
Copy link
Author

Greg-Freeman commented Dec 3, 2020

Thanks for the link.

Thank you for the report. This is a visual studio issue, for which the resolution can be found here: https://github.com/unoplatform/uno/blob/master/doc/articles/get-started-wizard.md#initializecomponent-or-xname-variable-is-not-available-in-code-behind

You can follow the other known issues in this document, and in the global list of issues we're tracking: #982.

GitHub**unoplatform/uno**Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported. - unoplatform/uno

Thanks for the link. I did try those solutions and it wasn't resolving the problem. However, I think doing that as well as deleting the .suo files then restarting VS may have ultimately been the thing that did the trick. Unfortunately I went through a lot of additional troubleshooting steps so I'm not sure the exact thing that ultimately resolved it for me. I may dig into it a bit further and be more methodical about it if I and find the time.

GitHub
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported. - unoplatform/uno

@Greg-Freeman
Copy link
Author

steps above seemed to work

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 kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants