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

VS For Mac's XAML tools broken after updating VS and/or Xamarin.Forms #11555

Closed
Tommigun1980 opened this issue Jul 25, 2020 · 4 comments
Closed

Comments

@Tommigun1980
Copy link

Hi. I posted this to the VS For Mac forum, but I am not sure if this is a Xamarin.Forms problem or a VS For Mac problem so I am posting it here as well:
https://developercommunity.visualstudio.com/content/problem/1124589/vs-for-mac-87-preview-build-2007-crashes-every-few.html

My development environment is now completely broken for Xamarin development and I am unable to proceed.
Thank you for your help!

@Tommigun1980 Tommigun1980 added s/unverified New report that has yet to be verified t/bug 🐛 labels Jul 25, 2020
@Tommigun1980
Copy link
Author

I am pasting in the most relevant errors here.

The error in the VS logs, when saving an XAML file (which should hot reload the app):

ERROR [2020-07-25 03:55:47Z]: Error while executing command: Save
System.InvalidOperationException: Invalid action command id: Xamarin.HotReload.Ide.IdeConstants.RuntimeCommands.EnvironmentOverrides
  at MonoDevelop.Components.Commands.CommandManager.GetCommandInfo (System.Object commandId, MonoDevelop.Components.Commands.CommandTargetRoute targetRoute, System.Threading.CancellationToken cancelToken) [0x00013] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:2257 
  at MonoDevelop.Components.Commands.CommandManager.GetCommandInfo (System.Object commandId, MonoDevelop.Components.Commands.CommandTargetRoute targetRoute) [0x00000] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:2237 
  at MonoDevelop.Components.MainToolbar.MainToolbarController+ButtonBarButton.Update () [0x00033] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs:1064 
  at MonoDevelop.Components.MainToolbar.MainToolbarController.MonoDevelop.Components.Commands.ICommandBar.Update (System.Object activeTarget) [0x00081] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs:1010 
  at MonoDevelop.Components.Commands.CommandManager.UpdateToolbars () [0x00031] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:3099 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, MonoDevelop.Components.Commands.CommandSource source, System.Nullable`1[T] time, MonoDevelop.Components.Commands.CommandInfo sourceUpdateInfo) [0x00338] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:2076 

The error when turning on hot reload in VS For Mac settings (after having toggled it off):

INFO [2020-07-25 03:50:05Z]: Add-in loaded: Xamarin.HotReload.VSMac.Xamarin.HotReload.VSMac
ERROR [2020-07-25 03:50:09Z]: Error while executing command: Extensions...
System.InvalidOperationException: Invalid action command id: Xamarin.HotReload.Ide.IdeConstants.RuntimeCommands.EnvironmentOverrides
  at MonoDevelop.Components.Commands.CommandManager.GetCommandInfo (System.Object commandId, MonoDevelop.Components.Commands.CommandTargetRoute targetRoute, System.Threading.CancellationToken cancelToken) [0x00013] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:2257 
  at MonoDevelop.Components.Commands.CommandManager.GetCommandInfo (System.Object commandId, MonoDevelop.Components.Commands.CommandTargetRoute targetRoute) [0x00000] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:2237 
  at MonoDevelop.Components.MainToolbar.MainToolbarController+ButtonBarButton.Update () [0x00033] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs:1064 
  at MonoDevelop.Components.MainToolbar.MainToolbarController.MonoDevelop.Components.Commands.ICommandBar.Update (System.Object activeTarget) [0x00081] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs:1010 
  at MonoDevelop.Components.Commands.CommandManager.UpdateToolbars () [0x00031] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:3099 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, MonoDevelop.Components.Commands.CommandSource source, System.Nullable`1[T] time, MonoDevelop.Components.Commands.CommandInfo sourceUpdateInfo) [0x00368] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:2082

The error in VS For Mac logs when it is opened (even when no solution is loaded):

ERROR [2020-07-25 03:29:48Z]: Error while loading diagnostics in Microsoft.CodeAnalysis.Scripting, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
ERROR [2020-07-25 03:29:48Z]: Error while loading diagnostics in Microsoft.CodeAnalysis.Scripting, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/Assembly.cs:243 
  at MonoDevelop.AnalysisCore.MonoDevelopWorkspaceDiagnosticAnalyzerProviderService+OptionsTable.ProcessAssembly (System.Reflection.Assembly asm) [0x00148] in /Users/builder/azdo/_work/1/s/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/MonoDevelopWorkspaceDiagnosticAnalyzerProviderService.OptionsTable.cs:110 
  at MonoDevelop.AnalysisCore.MonoDevelopWorkspaceDiagnosticAnalyzerProviderService.CreateHostDiagnosticAnalyzerPackages () [0x000a3] in /Users/builder/azdo/_work/1/s/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/MonoDevelopWorkspaceDiagnosticAnalyzerProviderService.cs:100 
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

I can also see the following error in there:

INFO [2020-07-25 03:32:17Z]: CodeTemplateService: No user templates, reading default templates.
INFO [2020-07-25 03:32:25Z]: Reading schemas from: /Users/tommikiviniemi/Library/VisualStudio/8.0/XmlSchemas
ERROR [2020-07-25 03:32:42Z]: 
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Designer.Forms.XamarinStudioFormsProjectItem.DocumentManager_ActiveDocumentChanged (System.Object sender, MonoDevelop.Ide.Gui.DocumentEventArgs e) [0x00008] in /Users/runner/runners/2.166.4/work/1/s/Xamarin.Designer.Forms/Xamarin.FormsPreviewer.MonoDevelop/Xamarin.Designer.Forms/XamarinStudioFormsProjectItem.cs:25 
  at System.CoreExtensions.SafeInvoke[T] (System.EventHandler`1[TEventArgs] events, System.Object sender, T args) [0x0000f] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Core/CoreExtensions.EventHandlers.cs:50 
WARNING [2020-07-25 03:32:42Z]: Unknown TargetFramework '.NETFramework,Version=v1.1' is being requested from SystemAssemblyService, returning empty TargetFramework

@hartez hartez added i/critical and removed s/unverified New report that has yet to be verified labels Jul 25, 2020
@Tommigun1980
Copy link
Author

Tommigun1980 commented Jul 25, 2020

So my process to get the system in an unusable state (where even deleting everything related to VS and Xamarin didn't help) was:

  • Update Xamarin.Forms to latest preview release (preview 2 from preview 1).
  • Update VS to latest preview release (from 8.6.6).
  • Notice VS crashing.
  • Downgrade VS to latest stable (which at this point had been upped to 8.6.7).
  • VS kept crashing so I downgraded Xamarin.Forms (back to latest stable, which had also been working).
  • VS crashes went away, but XAML editing functionality was not restored and the above errors were still happening.
  • Completely uninstalled VS for Mac by following the instructions at https://docs.microsoft.com/en-us/visualstudio/mac/uninstall?view=vsmac-2019.
  • Didn't help, but noticed that my VS For Mac settings were not reset by following the procedure at https://docs.microsoft.com/en-us/visualstudio/mac/uninstall?view=vsmac-2019.
  • Dug around in my user's home folder until I found the hidden folder ~/.mono, deleted it, reinstalled VS.
  • Now VS For Mac's settings were reset (the dark theme was no longer active etc.), and now everything works!

So clearly something is wrong there, and only deleting VS for Mac's settings in ~/.mono (which is not mentioned at https://docs.microsoft.com/en-us/visualstudio/mac/uninstall?view=vsmac-2019 btw, may want to add it to the docs) helped. This is a heads up that this may be happening to anyone else who in the future will update either Xamarin.Forms and/or VS - I don't know which of those caused it but I'm more than happing being able to resume work, so this is no longer a critical issue for me.

Thanks!

@Tommigun1980 Tommigun1980 changed the title [Bug] URGENT/FATAL: VS For Mac's XAML tools broken VS For Mac's XAML tools broken after updating VS and/or Xamarin.Forms Jul 25, 2020
@Tommigun1980
Copy link
Author

@hartez From my point of view you can remove the critical tag as I found the workaround outlined in my previous post.
Thank you.

StephaneDelcroix added a commit that referenced this issue Jul 27, 2020
- move both implicit operator to the same type (Rectangle)
- remove setters on convenience properties

- fixes #11557
- fixes #11555
- fixes maybe #11542 (to be confirmed)
StephaneDelcroix added a commit that referenced this issue Jul 27, 2020
- move both implicit operator to the same type (Rectangle)
- remove setters on convenience properties

- fixes #11557
- fixes #11555
- fixes maybe #11542 (to be confirmed)
@Tommigun1980
Copy link
Author

Tommigun1980 commented Jul 30, 2020

@StephaneDelcroix Just wanted to confirm that the fix fixes this fully, as I had to delete ~/.mono before the system became usable again, even after uninstalling pre-2?
Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants