Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Multithreading 从Silverlight调用NtQueryTimeResolution_Multithreading_.net 4.0_Silverlight 5.0 - Fatal编程技术网

Multithreading 从Silverlight调用NtQueryTimeResolution

Multithreading 从Silverlight调用NtQueryTimeResolution,multithreading,.net-4.0,silverlight-5.0,Multithreading,.net 4.0,Silverlight 5.0,我有一个Silverlight库项目,其中有一个大控件 我想在某个时间点将PC定时器的分辨率降低到5ms 我尝试使用NtQueryTimeResolution,但出现异常: Attempt by security transparent method SetupTimer() to call native code through method NtQueryTimerResolution(UInt32 ByRef, UInt32 ByRef, UInt32 ByRef) failed. Me

我有一个Silverlight库项目,其中有一个大控件

我想在某个时间点将PC定时器的分辨率降低到5ms

我尝试使用NtQueryTimeResolution,但出现异常:

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.
设置计时器方法具有安全属性。。所以我不明白什么是错的

    [SecuritySafeCritical]
    private void SetupTimer()
    {
        uint resolution = 0;

        NtSetTimerResolution(50000, true, ref resolution);
    }

找到解决方案-在Silverlight应用程序项目属性中选中“在浏览器中运行时需要提升信任”