I just found that CurrentValue[$FrontEnd,"ScreenInformation"] will generate (some of) the symbols it uses as keys in the current context of the first evaluation (it might do so for other properties but "ScreenInformation" is the one I know of). To replicate evaluate the following in a fresh Kernel:
Block[{$Context = "testcontext`"},
CurrentValue[$FrontEnd, "ScreenInformation"]
]
{{testcontext`ScreenArea -> {{66, 1920}, {0, 1200}},
testcontext`FullScreenArea -> {{0, 1920}, {0, 1200}},
testcontext`BitDepth -> 32,
testcontext`Resolution ->
96}, {testcontext`ScreenArea -> {{-1280, 0}, {0, 1024}},
testcontext`FullScreenArea -> {{-1280, 0}, {0, 1024}},
testcontext`BitDepth -> 32, testcontext`Resolution -> 96}}
From now on, CurrentValue seems to always return (some) symbols in that context:
CurrentValue[$FrontEnd, "ScreenInformation"]
{{testcontext`ScreenArea -> {{66, 1920}, {0, 1200}},
FullScreenArea -> {{0, 1920}, {0, 1200}},
testcontext`BitDepth -> 32,
Resolution ->
96}, {testcontext`ScreenArea -> {{-1280, 0}, {0, 1024}},
FullScreenArea -> {{-1280, 0}, {0, 1024}},
testcontext`BitDepth -> 32, Resolution -> 96}}
Which symbols are created in which context is somewhat random when I try it with 11.3 and seems to be different in a fresh frontend session than in a fresh kernel started from an existing frontend session.
Why is this a problem? If you will do something like:
ScreenArea /. First[CurrentValue[$FrontEnd, "ScreenInformation"]]
in another context than the original this might not work as the context of ScreenArea might not match.
- Would anyone agree that this is a bug?
- What are suggested workarounds?