Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnauthorizedAccessException accessing font programmatically #691

Open
stinos opened this issue Jun 19, 2023 · 1 comment
Open

UnauthorizedAccessException accessing font programmatically #691

stinos opened this issue Jun 19, 2023 · 1 comment

Comments

@stinos
Copy link

stinos commented Jun 19, 2023

Cascadia family version

2111.001

Cascadia family variant(s)

Cascadia Code (the version with ligatures)

Font file format(s)

Windows Terminal included version (TTF (variable)), .ttf (variable)

Platform

Windows 10

Other Software

No response

What happened?

I'm assuming VSCode or Windows Terminal installed the Cascadia fonts (I have Code and Mono). Recently, running the latest release of https://github.com/lucasg/Dependencies resulted in an unhandled exception. Likewise, going to Start->Font Settings and clicking on the Cascadia Mono font results in an unhandled exception in SystemSettings.exe. I uninstalled all Cascadia fonts, downloaded the ttf and installed them again 'For all users' but the issue remains. In the Dependencies code it can be seen that the exception occurs when calling GetTypefaces on the FontFamily instance for Cascadia Code.

Code to reproduce:

            foreach (var family in System.Windows.Media.Fonts.SystemFontFamilies)
            {
                foreach (var typeface in family.GetTypefaces())
                {
                }
            }

Exception message is "UnauthorizedAccessException: Attempted to perform an unauthorized operation."

Call stack:

   at MS.Internal.Text.TextInterface.Native.Util.ConvertHresultToException(Int32 hr)
   at MS.Internal.Text.TextInterface.FontList.get_Item(UInt32 A_0)
   at MS.Internal.FontFace.TypefaceCollection.Enumerator.get_Current()
@rampaa
Copy link

rampaa commented Jan 19, 2024

Having the same problem here, any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants