Calling NtQueryTimerResolution from Silverlight

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);
    }

Answers


Found the solution - check "Require elevated trust when running in-browser" in the Silverlight app project properties.


Need Your Help

NSJSONSerialization only getting root key

objective-c ios json parsing nsjsonserialization

I'm having an issue parsing JSON from a PHP server using NSJSONSerialization. JSLint says my JSON is valid but appears to only be able to get one-two levels in.

Cannot write into ~/.m2 in docker maven container

bash maven docker

Why aren't files written in /root/.m2 in the maven3 docker image persistent during the build?