views:

166

answers:

5

Hi,

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.

A: 

http://www.c-sharpcorner.com/UploadFile/questpond/311072008102315AM/3.aspx

Does this solve what you are looking for?

Priyank
StyleCop, FXCop are for coding guidelines they are different then what I need.
this. __curious_geek
+1  A: 

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

Prashanth
PEVerify is useful post-compilation, I need to do this before compilation in visual studio itself.
this. __curious_geek
I am not sure if there is tool that can detect this "before" compilation. Perhaps you might have to write a regex based custom tool ,that is then integrated into your IDE to check for this.But if you don't mind compilation, then why not get rid of the /unsafe compiler option and force the compiler to throw an error. All you have to do now is fix the compiler errors.
Prashanth
A: 

you can use PEVerify

Ahmed Said
A: 

Maybe MoMA is what you need. This should give you some hints.

ya23
+1  A: 

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.

(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.)

Guffa