dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.94k stars 533 forks source link

An Exception is thrown in VS 2017 when opening an existing project with a layout file (axml) #1274

Closed rob8861 closed 6 years ago

rob8861 commented 6 years ago

Steps to Reproduce

  1. Create an empty activity xamarin.Android project in Visual Studio 2017
  2. Double click on the Main.axml and open the desginer
  3. Add few controls, it doesn't matter what you add
  4. Save the project and make sure the Main.axml remains open in Visual Studio
  5. Close Visual Studio
  6. Launch VS and open the project. You should now get an exception from VS complaining about a failed extension

Expected Behavior

Launching a project with a layout file already open should not cause Visual Studio to throw an exception.

Actual Behavior

Visual studio throws the exception below

<entry>
    <record>624</record>
    <time>2018/02/05 18:38:17.821</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;   at Xamarin.VisualStudio.Android.Designer.MonoAndroidDesignerService.FindBestAndroidTarget(DesignerProject designerProject, Int32 apiLevel) in E:\A\_work\12\s\Xamarin.Designer.VisualStudio\src\VisualStudio.Android.Designer\MonoAndroidDesignerService.cs:line 136&#x000D;&#x000A;   at Xamarin.VisualStudio.Android.Designer.AxmlTextViewCreationListener.VsTextViewCreated(IVsTextView textViewAdapter) in E:\A\_work\12\s\Xamarin.Designer.VisualStudio\src\VisualStudio.Android.Designer\Editor\AxmlTextViewCreationListener.cs:line 59&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.&lt;&gt;c__DisplayClass565_0.&lt;SendVsTextViewCreated&gt;b__0()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
  </entry>

Version Information

Microsoft Visual Studio Professional 2017 Version 15.5.5 VisualStudio.15.Release/15.5.5+27130.2026 Microsoft .NET Framework Version 4.7.02053

Installed Version: Professional

Visual Basic 2017 00370-10001-14471-AA819 Microsoft Visual Basic 2017

Visual C# 2017 00370-10001-14471-AA819 Microsoft Visual C# 2017

Visual C++ 2017 00370-10001-14471-AA819 Microsoft Visual C++ 2017

Visual F# 4.1 00370-10001-14471-AA819 Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package 8.10.01106.1 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017 15.0.31127.0 ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services 1.0 Provides languages services for ASP.NET Core Razor.

Azure App Service Tools v3.0.0 15.0.31106.0 Azure App Service Tools v3.0.0

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service 2.0 JavaScript Language Service

JetBrains ReSharper Ultimate 2017.3.2 Build 111.0.20180201.63358 JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2018 JetBrains, Inc.

Merq 1.1.17-rc (cba4571) Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Continuous Delivery Tools for Visual Studio 0.3 Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 4.8.4-pre (3fe64e3) Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 4.5.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

SQL Server Data Tools 15.1.61710.120 Microsoft SQL Server Data Tools

TypeScript Tools 15.5.11025.1 TypeScript Tools for Microsoft Visual Studio

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake 1.0 Visual Studio Tools for CMake

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Xamarin 4.8.0.760 (fc93f3f5b) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 4.8.188 (c5813fa34) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK 8.1.5.0 (HEAD/75f8c6838) Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK 11.6.1.4 (db807ec) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Log File

VS bug #563441

garuma commented 6 years ago

Thanks for the report!

We fixed this issue for the next release (currently in preview).