System.Environment.get_CurrentManagedThreadId() [英] System.Environment.get_CurrentManagedThreadId()

查看:99
本文介绍了System.Environment.get_CurrentManagedThreadId()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于此错误的报道很多:

There have been various reports on this error :

http://stackoverflow.com/questions/15569664/system-missingmethodexception-int32-system-environment-get-currentmanagedthread

http://stackoverflow.com/questions/15569664/system-missingmethodexception-int32-system-environment-get-currentmanagedthread

https://forum.unity3d.com/threads/monodevelop-build-failed.275506/

https://forum.unity3d.com/threads/monodevelop-build-failed.275506/

堆栈溢出最能说明问题(和原因),但是,如果您在.Net 4.5上进行开发,但客户最多只能使用.Net 4.0,那么我找不到任何可行的解决方案.  尽管我们的目标是4.0,但VS仍以4.5为基础.

The stack overflow best describes the issue (and cause), however I can find nowhere a plausible solution if you develop on .Net 4.5, but have customers which have only up to .Net 4.0.  Although we target 4.0, VS still uses 4.5 as a base.

有什么方法可以强制"编译为4.0,因为我们有企业客户,而他们的公司政策根本不允许升级到4.5(或更高版本)?

Is there any way we can 'force' the compile to 4.0 as we have enterprise clients who's company policy simply do not allow upgrades to 4.5 (or higher) ?

此致

亚历克斯

推荐答案

Alex

>>有什么方法可以强制"将其编译为4.0,因为我们有企业客户,而他们的公司政策根本不允许升级到4.5(或更高版本)?

>>Is there any way we can 'force' the compile to 4.0 as we have enterprise clients who's company policy simply do not allow upgrades to 4.5 (or higher) ?

实际上,编号.Environment.CurrentManagedThreadId属性自4.5 .Net Framework以来可用.我建议你 说服您的客户升级到最新的.Net框架.因为 有关管理异步处理和多线程的各种改进,请参见4.5.始终最好保留最新版本的框架 如果可以的话.

Actually, No. Environment.CurrentManagedThreadId Property available since 4.5 .Net Framework. I would suggest you to persuade your customer to upgrade to the latest .Net framework. Because go to 4.5 for the various improvements in managing asynchronous processing and multi-threading.  And a variety of other factors that would make upgrading a wise idea. Always best to stay on the most recent version of a framework if you can.

>>事实4:此 更改 的实现;在4.0中,它使用(在生成的迭代器类型的构造函数中)Thread.CurrentThread.ManagedThreadId –在4.5中,它使用Environment.CurrentManagedThreadId; 它基于发现它已加载的框架版本(考虑目标定位等)做出决定

>>fact 4: the implementation for this changes between 4.0 and 4.5; in 4.0, it uses (in the generated iterator-type’s constructor) Thread.CurrentThread.ManagedThreadId – but in 4.5 it uses Environment.CurrentManagedThreadId; it makes this decision based on the framework version it finds it has loaded (taking into account targeting etc)

在该页面上,您可以按照Marc的说法尝试使用Thread.CurrentThread.ManagedThreadId,因为它在4.0中有效.这种方式值得一试.

From that page, you may try as Marc said, use Thread.CurrentThread.ManagedThreadId instead, because it works in 4.0. This way worth a try.

最诚挚的问候,

Kristin 

Kristin  


这篇关于System.Environment.get_CurrentManagedThreadId()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆