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.
4 个解决方案
#1
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
PE Verify是检查类型安全性的有用工具。它本身不标记非托管代码。有关更多信息,请访问http://msdn.microsoft.com/en-us/library/62bwd2yd(VS.80).aspx
#2
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 like ArrayList
and HashTable
. They should not be used at all any more, as there are strongly typed replacements in the System.Collection.Generic
namespace.
在托管代码中,一切都是类型安全的(因为编译器不会让你做任何不安全的转换),你正在寻找的是“弱类型”。您可以首先在System.Collection命名空间中搜索类,如ArrayList和HashTable。它们不应再被使用,因为System.Collection.Generic命名空间中存在强类型替换。
(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.)
(在这种情况下,我使用弱打字的引号,因为这个术语有很多不同的定义,我们只是在寻找它的某些方面。)
#3
http://www.c-sharpcorner.com/UploadFile/questpond/311072008102315AM/3.aspx
Does this solve what you are looking for?
这会解决您的需求吗?
#1
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
PE Verify是检查类型安全性的有用工具。它本身不标记非托管代码。有关更多信息,请访问http://msdn.microsoft.com/en-us/library/62bwd2yd(VS.80).aspx
#2
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 like ArrayList
and HashTable
. They should not be used at all any more, as there are strongly typed replacements in the System.Collection.Generic
namespace.
在托管代码中,一切都是类型安全的(因为编译器不会让你做任何不安全的转换),你正在寻找的是“弱类型”。您可以首先在System.Collection命名空间中搜索类,如ArrayList和HashTable。它们不应再被使用,因为System.Collection.Generic命名空间中存在强类型替换。
(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.)
(在这种情况下,我使用弱打字的引号,因为这个术语有很多不同的定义,我们只是在寻找它的某些方面。)
#3
http://www.c-sharpcorner.com/UploadFile/questpond/311072008102315AM/3.aspx
Does this solve what you are looking for?
这会解决您的需求吗?
#4
Maybe MoMA is what you need. This should give you some hints.
也许MoMA就是你所需要的。这应该给你一些提示。