CodeContracts metadata errors during rewriting

I am trying to use code contracts with .NET 3.5 in a large desktop application project that also has a C ++ DLL dependency on mixed mode written in the old C ++ managed syntax.

The real solution consists of at least 20 projects, but suggests that there are only projects A, B, C and D and the mixed mode project M. C depends on A, B and M. A, B and C are configured to perform the check during execution, and rewriting code works well. Now I wanted to add some contracts to one of the higher-level pickers, since D. D depends on everyone else, A, B, C, and M, too. Now rewriting the code does not work for D with the following message (I changed the names):

15>    Reading assembly 'C' from 'build\debug\C.dll' resulted in errors.
15>    ccrewrite : error : Rewrite aborted due to metadata errors. Check output window
15>        Input string was not in a correct format.
15>        Malformed signature.
15>        Index was outside the bounds of the array.
15>        Malformed signature.
15>        Could not resolve type reference: [M]Name.Space.Class1.
15>        Could not resolve type reference: [M].EnumType.
15>        Malformed signature.
15>        Malformed signature.
15>        Could not resolve type reference: [M]Name.Space.Class1.
15>        Could not resolve type reference: [M].EnumType.
15>        Malformed signature.
15>        Malformed signature.
15>        Input string was not in a correct format.
15>        Malformed signature.
15>        Could not resolve type reference: [M]Name.Space.Class1.
15>        Could not resolve type reference: [M].EnumType.
15>        Malformed signature.
15>        Malformed signature.
15>        Index was outside the bounds of the array.
15>        Malformed signature.

M, , ++ DLL. C , M.

, D, , , C.

1.2.21023.14

CodeContracts MSDN, , . , .

+3
1

, , .

+3

Source: https://habr.com/ru/post/1727200/


All Articles