microsoft / devhome

The new Dev Home experience for Windows!
https://aka.ms/devhomedocs
MIT License
3.62k stars 320 forks source link

NullReferenceException when adding a new repo to File Explorer Source Control Integration #3622

Closed adrastogi closed 2 months ago

adrastogi commented 2 months ago

Dev Home version

0.1701.592.0

Windows build number

10.0.23743.1000

Other software

OS Build Version: 10.0.23743.1000.amd64fre.ni_current_directadept.240814-1651 .NET Version: .NET 8.0.7

Steps to reproduce the bug

With the File Explorer Source Control Integration feature enabled:

  1. I picked a source folder on my machine and added it in the File Explorer page.
  2. Select Git from the dropdown

Expected result

I expected that the selection would succeed.

Actual result

Dev Home hung for a few seconds and then crashed. Here's the snippet I see in the logs:

[2024/08/16 09:41:15.998 INF] (SourceControlIntegration) Validating source control extension with arguments: extensionCLSID = A65E46FF-F979-480d-A379-1FDA3EB5F7C5, rootPath = D:\src\perf
[2024/08/16 09:41:16.579 INF] (SourceControlIntegration) Local repository opened successfully.
[2024/08/16 09:41:16.583 FTL] (DevHome) Unhandled exception: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Internal.Windows.DevHome.Helpers.FileExplorer.ExtraFolderPropertiesWrapper.Register(String rootFolderPath, Guid handlerClsid)
   at DevHome.Customization.ViewModels.FileExplorerViewModel.<>c__DisplayClass43_0.<<AssignSourceControlProviderToRepository>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at DevHome.Customization.ViewModels.FileExplorerViewModel.AssignSourceControlProviderToRepository(String extensionName, String rootPath)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()

Included System Information

CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz Physical Memory: 31.78GB (17.88GB free) Processor Architecture: x64

Included Extensions Information

Extensions: Microsoft.Windows.DevHome_0.1601.561.0_x648wekyb3d8bbwe (Core Widget Extension) Microsoft.Windows.DevHome_0.1601.561.0_x648wekyb3d8bbwe (Hyper-V Extension) Microsoft.Windows.DevHome_0.1601.561.0_x648wekyb3d8bbwe (Windows Subsystem for Linux Extension) Microsoft.Windows.DevHomeGitHubExtension_0.1600.561.0_x648wekyb3d8bbwe (Dev Home GitHub Extension (Preview)) Microsoft.Windows.DevHomeAzureExtension_0.1100.561.0_x648wekyb3d8bbwe (Dev Home Azure Extension (Preview)) Microsoft.Windows.DevHome.Canary_0.1701.592.0_x648wekyb3d8bbwe (Core Widget Extension) Microsoft.Windows.DevHome.Canary_0.1701.592.0_x648wekyb3d8bbwe (Hyper-V Extension) Microsoft.Windows.DevHome.Canary_0.1701.592.0_x648wekyb3d8bbwe (Windows Subsystem for Linux Extension) Microsoft.Windows.DevHome.Canary_0.1701.592.0_x648wekyb3d8bbwe (Git) Microsoft.Windows.DevHomeGitHubExtension.Canary_0.1700.589.0_x648wekyb3d8bbwe (Dev Home GitHub Extension (Canary))

Widget Service: MicrosoftWindows.Client.WebExperience_524.21802.0.0_x64cw5n1h2txyewy Microsoft.WidgetsPlatformRuntime_1.4.0.0_x648wekyb3d8bbwe

github-actions[bot] commented 2 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

ssparach commented 2 months ago

The logs do indicate that the LocalRepositoryProvider could be obtained for the repo and the exception was thrown inside the helpers package during registration with File Explorer. The linked PR will prevent Dev Home from crashing if an exception is thrown during registration with File Explorer in the future. However, investigation may be required into why the NullReferenceException was thrown. I will try to see if I can reproduce this for further debugging. Note: The fix for a previous null reference issue is present in the OS build version this bug was created for.

DefaultRyan commented 2 months ago

The logs do indicate that the LocalRepositoryProvider could be obtained for the repo and the exception was thrown inside the helpers package during registration with File Explorer. The linked PR will prevent Dev Home from crashing if an exception is thrown during registration with File Explorer in the future. However, investigation may be required into why the NullReferenceException was thrown. I will try to see if I can reproduce this for further debugging. Note: The fix for a previous null reference issue is present in the OS build version this bug was created for.

I think I figured this out. There was a similar null reference that was fixed on the OS side, but this one is happening in Microsoft.Internal.Windows.DevHome.Helpers. Luckily, that's a super-simple fix that we can ingest quickly.

DefaultRyan commented 2 months ago

As a temporary workaround, you can attempt to re-register. The second attempt should succeed.