Repository navigation
fix: Edge/OneDrive Remover says whether OneDrive is installed, reaches Edge's update tasks, and undoes failed changes - #2922
Merged
Conversation
…s Edge's update tasks, and undoes failed changes - "Installed" is OneDrive.exe under LOCALAPPDATA or Program Files, not the setup Windows keeps in System32, and the cards read "Checking…" until the first read, or that the state could not be read. - Edge's update tasks are found by their name prefixes in the root task folder. The scripts report what they found and whether one refused, put back what they changed, and none found counts as not done. - A failed Disable Edge puts both policy values back as they were, and a failed Remove OneDrive leaves the File Explorer entry and says OneDrive was closed for the attempt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2810.
The tab decided "installed" from OneDrive's setup file, never reached Edge's update tasks, and two changes that failed still changed something.
OneDriveInstalledwasResolveOneDriveSetup() is not null, and the System32 copy of the setup survives an uninstall, so after a removal that worked the card said "OneDrive is installed." and Remove stayed on offer.IsOneDriveClientInstalledlooks for%LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exeand forMicrosoft OneDrive\OneDrive.exeunder Program Files and Program Files (x86);ResolveOneDriveSetupnow only finds the program to run. Remove is not applicable without OneDrive.exe. When OneDrive is installed but no setup is found, it fails and launches nothing, instead of saying OneDrive is not installed.StatusReadturns true inApply. Until then each card reads "Checking OneDrive…" or "Checking Microsoft Edge…", and if that first read fails, that the state could not be read. The two "not installed, nothing to do" shortcuts apply only once the state is known.MicrosoftEdgeUpdateTaskMachineCore{7A6CBB87-…}andMicrosoftEdgeUpdateTaskMachineUA{A505C5E6-…}, and-TaskNamewith the bare names matched neither, with the error suppressed, so Disable and Restore returned Success and changed no task. Both scripts now askGet-ScheduledTask -TaskName 'MicrosoftEdgeUpdateTaskMachineCore*','MicrosoftEdgeUpdateTaskMachineUA*'and keep the ones in the root folder. A wildcard name that matches nothing returns nothing without an error; beside-TaskPath '\'the same query throws, so the folder is filtered after. The change script skips a task already as asked, puts back the ones it changed when one refuses, and reportsFoundandRefused. The service treats none found or a refusal as not done. The status query counts any task that is notDisabledas enabled, where it counted onlyReady.DisableEdgeAsyncreads both values before writing them. When the tasks are not done, or the run throws, afinallywrites each value back with its own registry type, or deletes it if it was not set before. It does not useTrySetEdgeBackgroundDisabled(false), which the issue suggested, because that deletes a value set before the change, by an earlier Disable or by whoever manages the PC.A Restore Edge that fails still leaves its policies cleared, as before. That is the direction of the Windows defaults, and the card shows what is left.
Docs
README: the OneDrive and Edge bullets say what the card reads and what a failed change leaves behind. ARCHITECTURE:
EdgeOneDriveService's entry.Tests
EdgeOneDriveServiceTests(11 new cases): with the setup present and no OneDrive.exe the status reads not installed, and with OneDrive.exe installed; Remove with no OneDrive is not applicable, and with no setup fails, both launching nothing; a failed uninstall leaves the pin at 1 and a successful one sets it to 0; Disable with none found, with a refusal, with no report and with a run that throws returns Failed with both policies back, and a value set before the change is put back rather than deleted; Restore with none found or a refusal returns Failed. The two task tests now assert that each change runs the builder's own script.EdgeOneDriveViewModelTests(4 new cases): both cards read "Checking…" while the read is pending and the state after it; a failed first read says the state could not be read; a failed removal adds the note only when OneDrive had been running.EdgeOneDriveScriptTests(integration, 8 cases) runs both scripts in Windows PowerShell 5.1 with the three cmdlets shadowed by stubs that match names asGet-ScheduledTaskdoes: tasks with the ID in their names are found and changed, a task with the same prefix in another folder is left alone, a task already as asked is skipped, a refusal puts back the one changed, none found reports 0 without stopping, a failed read stops the script, and the status query's answer.EdgeOneDriveServiceTests,EdgeOneDriveViewModelTests,ArchitectureTestsandInclusiveTermsTests(300), and the four script test classes (29). All four projects build with 0 warnings, anddotnet format --verify-no-changesis clean.