xamarin/Xamarin.Forms

[Bug] Variable not created when using x:Name in XAML with Shared Project

Open

#9,303 opened on 2020年1月23日

GitHub で見る
 (2 comments) (0 reactions) (0 assignees)C# (5,644 stars) (1,926 forks)batch import
a/Xaml </>external-intellisensehelp wantedi/lowt/bug :bug:up-for-grabs

説明

Description

No variable is available in C# after assigning x:Name="..." to a control in a XAML Shared Project/

Steps to Reproduce

  1. Create a Blank Xamarin.Forms application
  2. Choose Shared Library
  3. Open the Main.xaml file and add x:Name="myLabel" to the Label in there.
  4. Save the file
  5. Open Main.xaml.cs and try and use myLabel in code

Expected Behavior

IntelliSense should recognize myLabel / the variable should be available for use.

Actual Behavior

myLabel is not recognized.

Basic Information

=== Visual Studio Enterprise 2019 for Mac (Preview) ===

Version 8.5 Preview (8.5 build 1634)
Installation UUID: 8f53ca54-7d45-4b21-bf6c-21673a324eb8
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.14.1.17 (d16-5 / d30880059)

	Package version: 608000087

=== Mono Framework MDK ===

Runtime:
	Mono 6.8.0.87 (2019-10/df42020fe6f) (64-bit)
	Package version: 608000087

=== Xamarin Designer ===

Version: 16.5.0.382
Hash: c3bbd0524
Branch: remotes/origin/d16-5
Build date: 2019-12-30 21:46:42 UTC

=== Roslyn (Language Service) ===

3.4.0-beta4-19568-04+82f2e2541478e239dc4b04f231e90dc2b3dcb422

=== NuGet ===

Version: 5.4.0.6315

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.100/Sdks
SDK Versions:
	3.1.100
	3.1.100-preview3-014645
	3.1.100-preview2-014569
	3.1.100-preview1-014459
	3.0.100
	3.0.100-rc1-014190
	3.0.100-preview9-014004
	3.0.100-preview8-013656
	2.2.203
	2.2.107
	2.1.700
	2.1.505
	2.1.302
	2.1.301
	2.1.4
	2.0.0-preview2-006497
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.8.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	3.1.0
	3.1.0-preview3.19553.2
	3.1.0-preview2.19525.6
	3.1.0-preview1.19506.1
	3.0.0
	3.0.0-rc1-19456-20
	3.0.0-preview9-19423-09
	2.2.5
	2.2.4
	2.1.15
	2.1.14
	2.1.13
	2.1.11
	2.1.9
	2.1.2
	2.1.1
	2.0.5
	2.0.0-preview2-25407-01

=== Xamarin.Profiler ===

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

=== Updater ===

Version: 11

=== Xamarin.Android ===

Not Installed

=== Microsoft Mobile OpenJDK ===

Java SDK: Not Found

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.5.0.35
Hash: dec50c3
Branch: remotes/origin/d16-5~1
Build date: 2020-01-15 11:09:10 UTC

=== Android Device Manager ===

Version: 16.5.0.65
Hash: 327dcef
Branch: remotes/origin/d16-5
Build date: 2020-01-15 11:09:32 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Apple Developer Tools ===

Xcode 11.3.1 (15715)
Build 11C504

=== Xamarin.Mac ===

Version: 6.14.1.17 (Visual Studio Enterprise)
Hash: d30880059
Branch: d16-5
Build date: 2020-01-07 18:20:41-0500

=== Xamarin.iOS ===

Version: 13.14.1.17 (Visual Studio Enterprise)
Hash: d30880059
Branch: d16-5
Build date: 2020-01-07 18:20:41-0500

=== Build Information ===

Release ID: 805001634
Git revision: 5263fbc02bf69c8c0b17668c0a4c5f85d28e139d
Build date: 2020-01-20 03:49:53-05
Build branch: release-8.5
Xamarin extensions: d0aedcf9b5602421ffd343d3cec1b4d74854acb2

=== Operating System ===

Mac OS X 10.15.1
Darwin 19.0.0 Darwin Kernel Version 19.0.0
    Thu Oct 17 16:17:15 PDT 2019
    root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

AddinMaker 1.5.0

Workaround

Build the iOS project. Now the variable is recognized. This is not an issue with NetStandard projects, only Shared.

コントリビューターガイド