0

After doing a side-by-side installation of Visual Studio 2022 RC, I now get the following error in a project that ran fine before the install.The namespaces in the XAML page and codebehind seem to match. I have made sure that the targeted Windows SDK is installed. Any suggestions as to what else I should check? This is a UWP project. Thanks.

 Windows.UI.Xaml.UnhandledExceptionEventArgs}
        Exception: {"Method not found: 'Boolean System.Threading.CancellationTokenRegistration.TryDeregister()'."}
        Handled: false
        Message: "System.MissingMethodException: Method not found: 'Boolean System.Threading.CancellationTokenRegistration.TryDeregister()'.\r\n   at System.Threading.Tasks.AsyncInfoToTaskBridge`2.Complete(IAsyncInfo asyncInfo, Func`2 getResultsFunction, AsyncStatus asyncStatus)\r\n   at System.Threading.Tasks.AsyncInfoToTaskBridge`2.CompleteFromAsyncOperation(IAsyncOperation`1 asyncInfo, AsyncStatus asyncStatus)"
        Native View: 0x170119f0 <Information not available, no symbols loaded for Windows.UI.Xaml.dll>

Also, now when I try to create a new project using Windows Template Studio, I get an "Object reference not set to an instance of an object error with the following details:

 System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.Templates.Core.Gen.GenController.ValidateUserSelection(UserSelection userSelection, Boolean isNewProject)
       at Microsoft.Templates.Core.Gen.NewProjectGenController.<UnsafeGenerateProjectAsync>d__4.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.Templates.UI.Services.GenerationService.<GenerateProjectAsync>d__5.MoveNext()

I'm thinking these issues must be related.

Matt
  • 145
  • 1
  • 13
  • Sounds like the partial classes (xaml/xaml.cs) are not merged on compile. You might check if the namespaces are correct. – Jeroen van Langen Oct 19 '21 at 21:08
  • Thanks, Jeroen. It looks like my namespace on the view and code behind pages match up. On the view, I have x:Class="MyApp.Views.ShellPage. On the code behind, I have namespace MyApp.Views and public sealed partial class ShellPage : BindablePage. Is there something I'm missing here? – Matt Oct 20 '21 at 13:27
  • Have you tried to do it in the Old Version of VS like VS 2019 to confirm if this issue is related to the VS? – Roy Li - MSFT Oct 21 '21 at 02:29
  • Yes, I do the error in VS 2019 as well as in VS 2022 RC. However, it only started after I installed VS 2022 RC. – Matt Oct 21 '21 at 12:53
  • That's interesting. Do you have other devices? Does this happen to other devices that installed VS as well? Based on your description, you could launch your app correctly from the VS, right? – Roy Li - MSFT Oct 25 '21 at 08:12
  • I finally had to give up on this one and just revert back to an older version of my application. The older version does run correctly in VS 2019 and VS 2022. I'm sure it was some sort of error on my part. – Matt Nov 15 '21 at 14:28

0 Answers0