I have Silverlight library project with large control in it.
I want to bring PC timer resolution at certain point of time down to 5ms.
I tried to use NtQueryTimerResolution but got exception:
Attempt by security transparent method SetupTimer() to call native code through method
NtQueryTimerResolution(UInt32 ByRef, UInt32 ByRef, UInt32 ByRef) failed. Methods must be
security critical or security safe-critical to call native code.
The setup timer method has security attribut on it.. so i dont get whats wrong…
[SecuritySafeCritical]
private void SetupTimer()
{
uint resolution = 0;
NtSetTimerResolution(50000, true, ref resolution);
}
Found the solution – check “Require elevated trust when running in-browser” in the Silverlight app project properties.