Repository: PowerToys
Issue: Outlook LOG preview error: This file cannot be previewed because there is no previewer installed for it
Labels: Issue-Bug,Needs-Triage

### Microsoft PowerToys version

0.85.1

### Installation method

Microsoft Store

### Running as admin

No

### Area(s) with issue?

File Explorer: Preview Pane, File Explorer: Thumbnail preview

### Steps to reproduce

1. Open regedit
2. Navigate to [HKEY_CLASSES_ROOT\.txt\shellex\
3. If the key {8895b1c6-b41f-4c1c-a562-0d564250836f} exist, delete it
4. Open Notepad/Editor and create an text file with the ending .txt
5. Copy the the file and change the extension to .log
6. Open Microsoft Outlook
7. Create a new E-Mail to yourself, attach both the .txt and .log file and send it to yourself
8. Open the E-Mail and click on the attachment, to display the preview of both files
9. Do you confirm that for both files the preview is displayed?
10. Open Microsoft Store
11. Search for PowerToys
12. Install [PowerToys](https://apps.microsoft.com/store/detail/XP89DCGQ3K6VLD?ocid=pdpshare)
13. PowerToys starts automatic after installation
14. In regedit hit the F5 key to refresh
15. The key {8895b1c6-b41f-4c1c-a562-0d564250836f} has been created
16. In Outlook display the preview of both files
17. Do you confirm that only the .txt file is displayed?
18. In regedit delete the key {8895b1c6-b41f-4c1c-a562-0d564250836f}
19. Open the E-Mail and click on the attachment, to display the preview of both files
20. Do you confirm that for both files the preview is displayed?

### ✔️ Expected Behavior

Either Microsoft PowerToys should not create the registry key:
`[HKEY_CLASSES_ROOT\.txt\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]`

Or Outlook should be able to display the preview of these files, too.

With the actual behavior I have either preview in File Explorer or in Outlook, except for .txt.

### ❌ Actual Behavior

After installing/updating Microsoft PowerToys (and starting it), it creates the registry key:
`[HKEY_CLASSES_ROOT\.txt\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]`
```
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.log]
@="txtfilelegacy"
"Content Type"="text/plain"
"PerceivedType"="text"

[HKEY_CLASSES_ROOT\.log\OpenWithProgids]
"AppX4ztfk9wxr86nxmzzq47px0nh0e58b8fw"=hex(0):

[HKEY_CLASSES_ROOT\.log\shellex]

[HKEY_CLASSES_ROOT\.log\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@="{D8034CFA-F34B-41FE-AD45-62FCBB52A6DA}"
```

This has the side effect, that Microsoft Outlook (365) no longer shows the Preview for attached .log files. Instead it shows the Error:
`This file cannot be previewed because there is no previewer installed for it. `

After deleting the key, Outlook show the Preview of .log files:
```
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.log]
@="txtfilelegacy"
"Content Type"="text/plain"
"PerceivedType"="text"

[HKEY_CLASSES_ROOT\.log\OpenWithProgids]
"AppX4ztfk9wxr86nxmzzq47px0nh0e58b8fw"=hex(0):

[HKEY_CLASSES_ROOT\.log\shellex]
```

### Other Software

_No response_

### Additional Information

#### 1.

On [How to Register a Preview Handler - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/shell/how-to-register-a-preview-handler) I can read the following under **Step 1:**

> Each preview handler ProgID subkey contains a subkey named shellex that contains a subkey always named {8895b1c6-b41f-4c1c-a562-0d564250836f}. The presence of that subkey tells the system that the handler is a preview handler.

#### 2.

On [Outlook PDF preview error: This file cannot be previewed because there is no previewer installed for it - Microsoft Support](https://support.microsoft.com/en-us/office/outlook-pdf-preview-error-this-file-cannot-be-previewed-because-there-is-no-previewer-installed-for-it-b78bfe24-ba13-44bd-8289-1919ece7ded2) I can read under **Issue 2:**

> [Microsoft PowerToys](https://docs.microsoft.com/windows/powertoys/?msclkid=92c6173aa63411ecbceeb3798168ad87) is installed and has overridden the PDF Preview setting.
> From the Windows Start Menu, search for PowerToys App and open it. Select File Explorer Add-ons and disable Enable PDF (.pdf) preview.

I checked this setting and `Enable PDF (.pdf) preview` is disabled, now and after installation.

#### 3.

I searched the registry for `{D8034CFA-F34B-41FE-AD45-62FCBB52A6DA}` and found the following key:
```
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{D8034CFA-F34B-41FE-AD45-62FCBB52A6DA}]
"DisplayName"="Monaco Preview Handler"
@="MonacoPreviewHandler"
"AppID"="{6d2b5079-2f0b-48dd-ab7f-97cec514d30b}"

[HKEY_CLASSES_ROOT\CLSID\{D8034CFA-F34B-41FE-AD45-62FCBB52A6DA}\InprocServer32]
@="C:\\Users\\blueicehaller\\AppData\\Local\\PowerToys\\PowerToys.MonacoPreviewHandlerCpp.dll"
"Assembly"="PowerToys.MonacoPreviewHandler, Version=v0.85.1.0, Culture=neutral"
"Class"="MonacoPreviewHandler"
"ThreadingModel"="Apartment"
```

When I disable under [File Explorer add-ons](https://learn.microsoft.com/en-us/windows/powertoys/file-explorer) the [Preview Pane](https://learn.microsoft.com/en-us/windows/powertoys/file-explorer#preview-pane-previewers) for [Source code files (Monaco)](https://learn.microsoft.com/en-us/windows/powertoys/file-explorer#settings-for-source-code-files-previewer), it deletes the key:
```
[HKEY_CLASSES_ROOT\.log\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@="{D8034CFA-F34B-41FE-AD45-62FCBB52A6DA}
```
It deletes further keys for source code files like .txt:
```
[HKEY_CLASSES_ROOT\.txt\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@="{D8034CFA-F34B-41FE-AD45-62FCBB52A6DA}"
```