microsoft/ailab · error · InvalidOperationException

The specified file is blocked and can not be unblocked.

Error message

The specified file is blocked and can not be unblocked. {pptPath}

What it means

StartPowerPoint must first remove the Windows Mark-of-the-Web zone identifier from the presentation via FileUnblocker.Unblock; PowerPoint refuses to open files downloaded from the internet unless they are unblocked. When Unblock reports failure, the method throws this InvalidOperationException rather than launching a blocked file. It fires when the pptx retains a blocked zone identifier that cannot be removed — typically due to file permissions, the file being locked by another process, or an unblocker implementation failure.

Solutions

  1. Check file permissions and that no other process holds the pptx open before unblocking
  2. Unblock the file manually (file Properties > Unblock, or PowerShell Unblock-File) to confirm it is the unblock step failing
  3. Catch the InvalidOperationException in the recording workflow, log pptPath, and skip or prompt the user instead of crashing
  4. Copy the file to a local temp location before opening, which often drops the zone identifier
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at VirtualStage/Speaker.Recorder/Speaker.Recorder/PowerPoint/PowerPointHelper.cs:65 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/ailab@89fe2fc620 (2026-09-13). Data as JSON: /api/errors/9d932e0d4b5111a3. Report an issue: GitHub.

Appendix: source

Thrown at VirtualStage/Speaker.Recorder/Speaker.Recorder/PowerPoint/PowerPointHelper.cs:65

            }
            catch (Exception e)
            {
                Debug.WriteLine($"Exception finding program for {extension}: {e}");
                return null;
            }
        }

        public static void Initilize()
        {
            powerPointPath = FindExtensionExe(".pptx");
        }

        public static Process StartPowerPoint(string pptPath)
        {
            var success = FileUnblocker.Unblock(pptPath);
            if (!success)
            {
                throw new InvalidOperationException($"The specified file is blocked and can not be unblocked. {pptPath}");
            }

            if (powerPointPath == null)
            {
                powerPointPath = FindExtensionExe(Path.GetExtension(pptPath));
            }

            var processName = Path.GetFileNameWithoutExtension(powerPointPath);
            var existingProcesses = Process.GetProcessesByName(processName);
            foreach (var item in existingProcesses)
            {
                var cmd = GetCommandLine(item);
                if (cmd?.Contains("/s", StringComparison.InvariantCultureIgnoreCase) == true)
                {
                    item.Kill();
                }
            }

View on GitHub (pinned to 89fe2fc620)