如何检查我的解决方案是否包含非托管代码?
我们有很多人致力于一个项目。 是否有任何工具可以扫描并检查我的整个解决方案是否有任何非托管代码或非类型安全代码?
目标是用完全托管的代码托管整个解决方案,找到漏洞并将其修复为类型安全和托管代码。
我需要考虑和处理哪些常见漏洞?
谢谢。
We have a number of people working on a project. Is there any tool that will scan and check my entire solution if it has any unmanaged code or non-typesafe code ?
The objective is to host the entire solution with completely managed code, find the loopholes and fix them to be type-safe and managed code.
What are the common loopholes I will need to consider and deal with ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
PE verify 是检查类型安全性的有用工具。 它本身并不标记非托管代码。 更多信息请访问 http://msdn.microsoft .com/en-us/library/62bwd2yd(VS.80).aspx
PE Verify is a useful tool for checking type safety. It does not flag unmanaged code per se. More information can be found at http://msdn.microsoft.com/en-us/library/62bwd2yd(VS.80).aspx
要发现非托管代码,只需在每个项目中禁止不安全代码并查看编译内容即可。
在托管代码中,一切都是类型安全的(因为编译器不会让您进行任何不安全的转换),您正在寻找的是“弱类型”。 您可以首先在
System.Collection
命名空间中搜索类,例如ArrayList
和HashTable
。 它们不应该再被使用,因为 System.Collection.Generic 命名空间中有强类型的替换。(在这种情况下,我在弱类型周围使用引号,因为该术语有许多不同的定义,并且我们只是在寻找它的某些方面。)
To spot unmanaged code just disallow unsafe code in each project and see what compiles.
In managed code everything is type safe (as the compiler won't let you do any unsafe casting), what you are looking for is rather "weak typing". You can start by searching for classes in the
System.Collection
namespace likeArrayList
andHashTable
. They should not be used at all any more, as there are strongly typed replacements in theSystem.Collection.Generic
namespace.(I use quotation marks around weak typing in this case, as there are many different definitions of the term, and we are only looking for some aspects of it.)
http://www.c-sharpcorner.com/UploadFile/questpond/ 311072008102315AM/3.aspx
这能解决您正在寻找的问题吗?
http://www.c-sharpcorner.com/UploadFile/questpond/311072008102315AM/3.aspx
Does this solve what you are looking for?
也许 MoMA 就是您所需要的。 这应该会给你一些提示。
Maybe MoMA is what you need. This should give you some hints.