By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,364 Members | 1,272 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,364 IT Pros & Developers. It's quick & easy.

Custom attributes are not consistent???

P: n/a
I've converted a non-trivial C++ library to managed, and get the following
unhelpful linker error:

Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom
attributes are not consistent: (0x0c0001a5).
Display.obj : error LNK2022: metadata operation failed (80131195) : Custom
attributes are not consistent: (0x0c000108).
The help for LNK2022 is completely useless:

metadata operation failed (HRESULT) : error_message

The linker detected an error while merging metadata. The metadata errors must
be resolved to link successfully.

One reason for LNK2022 is when a struct exists in multiple modules with the
same name, but with conflicting definitions, and when you compile with /clr.
<<

A search for "Custom attributes are not consistent" at MS turns up *NO*
results, and google/google groups only returns a few -- none of which really
discuss the problem or it (eventual?) solution.

In this case, I've looked over the source file, and there are no mystery
structs floating around, although my searches are far from definitive as the
project is composed of hundreds of inter-related files/headers.

Has *ANYONE* figured out or would MS care to elaborate on what the "Custom
attributes are not consistent" error means and what the final hex number
means? Apparently it has some dynamic value, as similar errors have different
values.

--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>
Nov 17 '05 #1
Share this Question
Share on Google+
16 Replies


P: n/a
Hello Bret,

Thanks for posting in the group.

Based on my understanding, the problem is: You are migrating an old C++
library project to managed C++ project. However, when you build the
project, you got several error LNK2022: metadata operation failed
(80131195) link error. Please let me know if I have misunderstood the
problem.

I searched in our database immediately when I saw your post. Unluckily, the
hits are small. And it seems that there were no similar report before. So
we can't tell exactly where the problem may reside now.

In order to troubleshoot the problem, could you please provide us a small
repro sample? We will look into it and reply with detailed information
here. You can reach me by removing online from my email address here.

I understand that C++ library is not trivial. Perhaps it is hard for you to
isolate the problem or create a repro sample. If so, I suggest you contact
our PSS (product support service) to have one support engineer specially
help you on it. If you need help on contacting PSS, please feel free to
post here and I will post back with detailed information.

If you have any more concerns on it, please feel free to post here. Thanks
very much and look forward to your response.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! 每 www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #2

P: n/a
Hmmm...

(I'm presuming that you work for/at Microsoft, or have internal contact w/ MS.)

Could you contact the compiler group and have them document the metadata
"Custom
attributes are not consistent" error?

Thanks

"Yan-Hong Huang[MSFT]" wrote:

Hello Bret,

Thanks for posting in the group.

Based on my understanding, the problem is: You are migrating an old C++
library project to managed C++ project. However, when you build the
project, you got several error LNK2022: metadata operation failed
(80131195) link error. Please let me know if I have misunderstood the
problem.

I searched in our database immediately when I saw your post. Unluckily, the
hits are small. And it seems that there were no similar report before. So
we can't tell exactly where the problem may reside now.

In order to troubleshoot the problem, could you please provide us a small
repro sample? We will look into it and reply with detailed information
here. You can reach me by removing online from my email address here.

I understand that C++ library is not trivial. Perhaps it is hard for you to
isolate the problem or create a repro sample. If so, I suggest you contact
our PSS (product support service) to have one support engineer specially
help you on it. If you need help on contacting PSS, please feel free to
post here and I will post back with detailed information.

If you have any more concerns on it, please feel free to post here. Thanks
very much and look forward to your response.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! 每 www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>
Nov 17 '05 #3

P: n/a
In the Whidbey release the linker will give better diagnostics.

For now the way to diagnose this is using ildasm to dump the metadata of the
..obj files to text and then search for the tokens (the hex numbers mentioned
in the error messages). Usually this is a source error where 2 translation
units define a type in a different way.

Ronald Laeremans
Visual C++ team

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
Hmmm...

(I'm presuming that you work for/at Microsoft, or have internal contact w/ MS.)
Could you contact the compiler group and have them document the metadata
"Custom
attributes are not consistent" error?

Thanks

"Yan-Hong Huang[MSFT]" wrote:

Hello Bret,

Thanks for posting in the group.

Based on my understanding, the problem is: You are migrating an old C++
library project to managed C++ project. However, when you build the
project, you got several error LNK2022: metadata operation failed
(80131195) link error. Please let me know if I have misunderstood the
problem.

I searched in our database immediately when I saw your post. Unluckily, the hits are small. And it seems that there were no similar report before. So we can't tell exactly where the problem may reside now.

In order to troubleshoot the problem, could you please provide us a small repro sample? We will look into it and reply with detailed information
here. You can reach me by removing online from my email address here.

I understand that C++ library is not trivial. Perhaps it is hard for you to isolate the problem or create a repro sample. If so, I suggest you contact our PSS (product support service) to have one support engineer specially
help you on it. If you need help on contacting PSS, please feel free to
post here and I will post back with detailed information.

If you have any more concerns on it, please feel free to post here. Thanks very much and look forward to your response.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! 每 www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.
--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>

Nov 17 '05 #4

P: n/a
Ronald -- thanks for the reply. (Please note, none of my comments are meant as
a personal attack on you.)
In the Whidbey release the linker will give better diagnostics.
I still stand by my previous post where I say it will be at least the 4th
release of the product before it is truly usable in a commercial environment.
For now the way to diagnose this is using ildasm to dump the metadata of the
.obj files to text and then search for the tokens (the hex numbers mentioned
in the error messages). Usually this is a source error where 2 translation
units define a type in a different way.
Thanks for defining the mystery error. I was *finally* able to find the source
of the problem and resolve it using the technique you describe -- thanks. My
comments follow for the purpose of actually documenting the procedure:

First, ILDASM is a mixed-mode application meaning that it has a GUI-mode and
console-mode interface.

When running in GUI mode, you *CANNOT* process .obj files (the only files that
are documented are .exe and .dll). This means that you must use the tool from
the command line (with the appropriate vars set through vsvars32.bat or by
running "Visual Studio .NET 2003 Command Prompt" from the VS.NET start menu
tools group).

When processing .obj files from the command line, YOU MUST REDIRECT THE OUTPUT
TO A FILE or else you will get no results - BUG! BUG! Additionally, you must
use the /text option to force output to the console. So, it boils down to:

ildasm your_source_file.obj /text /out=output.txt

The file output.txt is then created -- open it up and then search for the token
in question (the last hex number of the "Custom attributes are not consistent"
error. (NOTE: the output token identifiers *DO NOT* prefix hex numbers w/ the
traditional 0x -- so take this into account when searching for the token.)
This will locate the custom attribute of the token that is causing the error.
Once you know the token, it should be relatively easy to locate the actual
source of the problem.

So, presuming the following errors:

Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom
attributes are not consistent: (0x0c0001a5).

The steps would be:

ildasm Assignment.obj /text /out=assignment.txt

Search assignment.txt for "0c0001a5". It should find some custom attribute,
look up a few lines and locate the offending type. Armed with that, you can go
back to your source files and determine why the type (class/struct) is being
defined differently in the different source files.

NOTE TO MICROSOFT: Fix this stupid diagnostic! At the *BARE MINIMUM*, the
offending TYPE and ATTRIBUTE should be displayed *BY NAME* -- hex tokens in
diagnostics went out w/ Lattice C compilers and powdered wigs, they have
*ABSOLUTELY NO BUSINESS IN A 7TH-PLUS GENERATION PRODUCT*


Ronald Laeremans
Visual C++ team

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
Hmmm...

(I'm presuming that you work for/at Microsoft, or have internal contact w/

MS.)

Could you contact the compiler group and have them document the metadata
"Custom
attributes are not consistent" error?

Thanks

"Yan-Hong Huang[MSFT]" wrote:

Hello Bret,

Thanks for posting in the group.

Based on my understanding, the problem is: You are migrating an old C++
library project to managed C++ project. However, when you build the
project, you got several error LNK2022: metadata operation failed
(80131195) link error. Please let me know if I have misunderstood the
problem.

I searched in our database immediately when I saw your post. Unluckily, the hits are small. And it seems that there were no similar report before. So we can't tell exactly where the problem may reside now.

In order to troubleshoot the problem, could you please provide us a small repro sample? We will look into it and reply with detailed information
here. You can reach me by removing online from my email address here.

I understand that C++ library is not trivial. Perhaps it is hard for you to isolate the problem or create a repro sample. If so, I suggest you contact our PSS (product support service) to have one support engineer specially
help you on it. If you need help on contacting PSS, please feel free to
post here and I will post back with detailed information.

If you have any more concerns on it, please feel free to post here. Thanks very much and look forward to your response.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! 每 www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no

rights.

--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>


--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>
Nov 17 '05 #5

P: n/a
Hello Bret,

Thanks very much for your feedback and sharing your experience in how to
isolate the problem in the community. I am glad that Ronald's suggestion
help resolve the problem.

We will redirect your feedback to the product team. We are looking at
continual improvement, and it's this kind of feedback that let's us know
what things you're trying to do, that we haven't yet exposed for you.

If there is any any other feedback on our product, you can go to
http://register.microsoft.com/mswish...=EN-US&gssnb=1
to submit it.

For the usage of ildsam.exe, we can see it from MSDN:
Option Description
/output:filename Creates an output file with the specified filename, rather
than displaying the results in a dialog box.
/text Displays the results to the console window, rather than in a dialog
box or as an output file.
/? Displays the command syntax and options for the tool.

So the command string that you used is correct.

Thanks again for participating the community.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! 每 www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #6

P: n/a
> So the command string that you used is correct.

Right, but my point was that if you omit the /output=filename flag, you get
*NO* output (other than the header) to the console. That is a bug.

Thanks for the follow-up. I'll be glad to see these fixes in your product,
although I'd *much* rather have a service pack rather than wait for the next
point release.
"Yan-Hong Huang[MSFT]" wrote:

Hello Bret,

Thanks very much for your feedback and sharing your experience in how to
isolate the problem in the community. I am glad that Ronald's suggestion
help resolve the problem.

We will redirect your feedback to the product team. We are looking at
continual improvement, and it's this kind of feedback that let's us know
what things you're trying to do, that we haven't yet exposed for you.

If there is any any other feedback on our product, you can go to
http://register.microsoft.com/mswish...=EN-US&gssnb=1
to submit it.

For the usage of ildsam.exe, we can see it from MSDN:
Option Description
/output:filename Creates an output file with the specified filename, rather
than displaying the results in a dialog box.
/text Displays the results to the console window, rather than in a dialog
box or as an output file.
/? Displays the command syntax and options for the tool.

So the command string that you used is correct.

Thanks again for participating the community.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! 每 www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>
Nov 17 '05 #7

P: n/a
Hi Bret,
Right, but my point was that if you omit the /output=filename flag, you get
*NO* output (other than the header) to the console. That is a bug.


Got it. I will repro it on my side and report to product group.

Thanks very much for participating the community. If there is any we can do
for you, please feel free to post new messages in the group.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! 每 www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #8

P: n/a
Hi Bret,

I agree that the linker error you get in the VC 7.1 release is very far from
ideal. You are seeing some growing pains of fitting a separate compilation
model language like C++ into the CLR environment. We knew this issue going
into the release of VC 7.1, but the code base we had worked with compiling
to IJW internally and from the early adopters we got most feedback from
didn't have a large number of occurrences of this issue, so we traded
improving this off for other priority fixes. Subsequent experience both
internally and externally has shown it to be quite prevalent though. We have
been working on getting a KB out on this. I'll check on the status of that.

I am also sorry for my _very_ terse explanation on how to use ildasm and I
am glad you still were able to figure it out. We'll make sure your comments
on ildasm get to the author of that tool.

Ronald

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
Ronald -- thanks for the reply. (Please note, none of my comments are meant as a personal attack on you.)
In the Whidbey release the linker will give better diagnostics.
I still stand by my previous post where I say it will be at least the 4th
release of the product before it is truly usable in a commercial

environment.
For now the way to diagnose this is using ildasm to dump the metadata of the .obj files to text and then search for the tokens (the hex numbers mentioned in the error messages). Usually this is a source error where 2 translation units define a type in a different way.
Thanks for defining the mystery error. I was *finally* able to find the

source of the problem and resolve it using the technique you describe -- thanks. My comments follow for the purpose of actually documenting the procedure:

First, ILDASM is a mixed-mode application meaning that it has a GUI-mode and console-mode interface.

When running in GUI mode, you *CANNOT* process .obj files (the only files that are documented are .exe and .dll). This means that you must use the tool from the command line (with the appropriate vars set through vsvars32.bat or by
running "Visual Studio .NET 2003 Command Prompt" from the VS.NET start menu tools group).

When processing .obj files from the command line, YOU MUST REDIRECT THE OUTPUT TO A FILE or else you will get no results - BUG! BUG! Additionally, you must use the /text option to force output to the console. So, it boils down to:
ildasm your_source_file.obj /text /out=output.txt

The file output.txt is then created -- open it up and then search for the token in question (the last hex number of the "Custom attributes are not consistent" error. (NOTE: the output token identifiers *DO NOT* prefix hex numbers w/ the traditional 0x -- so take this into account when searching for the token.)
This will locate the custom attribute of the token that is causing the error. Once you know the token, it should be relatively easy to locate the actual
source of the problem.

So, presuming the following errors:

Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0001a5).

The steps would be:

ildasm Assignment.obj /text /out=assignment.txt

Search assignment.txt for "0c0001a5". It should find some custom attribute, look up a few lines and locate the offending type. Armed with that, you can go back to your source files and determine why the type (class/struct) is being defined differently in the different source files.

NOTE TO MICROSOFT: Fix this stupid diagnostic! At the *BARE MINIMUM*, the offending TYPE and ATTRIBUTE should be displayed *BY NAME* -- hex tokens in diagnostics went out w/ Lattice C compilers and powdered wigs, they have
*ABSOLUTELY NO BUSINESS IN A 7TH-PLUS GENERATION PRODUCT*


Ronald Laeremans
Visual C++ team

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
Hmmm...

(I'm presuming that you work for/at Microsoft, or have internal contact w/
MS.)

Could you contact the compiler group and have them document the
metadata "Custom
attributes are not consistent" error?

Thanks

"Yan-Hong Huang[MSFT]" wrote:
>
> Hello Bret,
>
> Thanks for posting in the group.
>
> Based on my understanding, the problem is: You are migrating an old C++ > library project to managed C++ project. However, when you build the
> project, you got several error LNK2022: metadata operation failed
> (80131195) link error. Please let me know if I have misunderstood the > problem.
>
> I searched in our database immediately when I saw your post. Unluckily, the
> hits are small. And it seems that there were no similar report
before. So
> we can't tell exactly where the problem may reside now.
>
> In order to troubleshoot the problem, could you please provide us a small
> repro sample? We will look into it and reply with detailed
information > here. You can reach me by removing online from my email address here. >
> I understand that C++ library is not trivial. Perhaps it is hard for you to
> isolate the problem or create a repro sample. If so, I suggest you

contact
> our PSS (product support service) to have one support engineer

specially > help you on it. If you need help on contacting PSS, please feel free to > post here and I will post back with detailed information.
>
> If you have any more concerns on it, please feel free to post here.

Thanks
> very much and look forward to your response.
>
> Best regards,
> Yanhong Huang
> Microsoft Community Support
>
> Get Secure! 每 www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no

rights.

--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence

<<38952rglkwdsl>>
--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>

Nov 17 '05 #9

P: n/a
Ronald -- thanks for the response & comments. I (as well as others) appreciate
the insight that you provide on the reasons for the issues, as well as a
commitment to clarify/resolve/fix the issue.

I've got to tell you, I'm *very* impressed w/ the response that I've been
getting to my issues from Microsoft. I've been out of the newsgroup community
for the past couple of years, but before I left, typical MS response to just
about any issue was: "That is a known issue and will be fixed in a future
release. <end>". It is readily apparent that you all have made a concerted
commitment to better handle issues, questions, and comments through the
newsgroups, and it is greatly appreciated.

Bret

"Ronald Laeremans [MSFT]" wrote:

Hi Bret,

I agree that the linker error you get in the VC 7.1 release is very far from
ideal. You are seeing some growing pains of fitting a separate compilation
model language like C++ into the CLR environment. We knew this issue going
into the release of VC 7.1, but the code base we had worked with compiling
to IJW internally and from the early adopters we got most feedback from
didn't have a large number of occurrences of this issue, so we traded
improving this off for other priority fixes. Subsequent experience both
internally and externally has shown it to be quite prevalent though. We have
been working on getting a KB out on this. I'll check on the status of that.

I am also sorry for my _very_ terse explanation on how to use ildasm and I
am glad you still were able to figure it out. We'll make sure your comments
on ildasm get to the author of that tool.

Ronald

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
Ronald -- thanks for the reply. (Please note, none of my comments are

meant as
a personal attack on you.)
In the Whidbey release the linker will give better diagnostics.


I still stand by my previous post where I say it will be at least the 4th
release of the product before it is truly usable in a commercial

environment.
For now the way to diagnose this is using ildasm to dump the metadata of the .obj files to text and then search for the tokens (the hex numbers mentioned in the error messages). Usually this is a source error where 2 translation units define a type in a different way.


Thanks for defining the mystery error. I was *finally* able to find the

source
of the problem and resolve it using the technique you describe -- thanks.

My
comments follow for the purpose of actually documenting the procedure:

First, ILDASM is a mixed-mode application meaning that it has a GUI-mode

and
console-mode interface.

When running in GUI mode, you *CANNOT* process .obj files (the only files

that
are documented are .exe and .dll). This means that you must use the tool

from
the command line (with the appropriate vars set through vsvars32.bat or by
running "Visual Studio .NET 2003 Command Prompt" from the VS.NET start

menu
tools group).

When processing .obj files from the command line, YOU MUST REDIRECT THE

OUTPUT
TO A FILE or else you will get no results - BUG! BUG! Additionally, you

must
use the /text option to force output to the console. So, it boils down

to:

ildasm your_source_file.obj /text /out=output.txt

The file output.txt is then created -- open it up and then search for the

token
in question (the last hex number of the "Custom attributes are not

consistent"
error. (NOTE: the output token identifiers *DO NOT* prefix hex numbers w/

the
traditional 0x -- so take this into account when searching for the token.)
This will locate the custom attribute of the token that is causing the

error.
Once you know the token, it should be relatively easy to locate the actual
source of the problem.

So, presuming the following errors:

Assignment.obj : error LNK2022: metadata operation failed (80131195) :

Custom
attributes are not consistent: (0x0c0001a5).

The steps would be:

ildasm Assignment.obj /text /out=assignment.txt

Search assignment.txt for "0c0001a5". It should find some custom

attribute,
look up a few lines and locate the offending type. Armed with that, you

can go
back to your source files and determine why the type (class/struct) is

being
defined differently in the different source files.

NOTE TO MICROSOFT: Fix this stupid diagnostic! At the *BARE MINIMUM*,

the
offending TYPE and ATTRIBUTE should be displayed *BY NAME* -- hex tokens

in
diagnostics went out w/ Lattice C compilers and powdered wigs, they have
*ABSOLUTELY NO BUSINESS IN A 7TH-PLUS GENERATION PRODUCT*


Ronald Laeremans
Visual C++ team

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
> Hmmm...
>
> (I'm presuming that you work for/at Microsoft, or have internal contact w/ MS.)
>
> Could you contact the compiler group and have them document the metadata > "Custom
> attributes are not consistent" error?
>
> Thanks
>
> "Yan-Hong Huang[MSFT]" wrote:
> >
> > Hello Bret,
> >
> > Thanks for posting in the group.
> >
> > Based on my understanding, the problem is: You are migrating an old C++ > > library project to managed C++ project. However, when you build the
> > project, you got several error LNK2022: metadata operation failed
> > (80131195) link error. Please let me know if I have misunderstood the > > problem.
> >
> > I searched in our database immediately when I saw your post. Unluckily, the
> > hits are small. And it seems that there were no similar report before. So
> > we can't tell exactly where the problem may reside now.
> >
> > In order to troubleshoot the problem, could you please provide us a
small
> > repro sample? We will look into it and reply with detailed information > > here. You can reach me by removing online from my email address here. > >
> > I understand that C++ library is not trivial. Perhaps it is hard for you to
> > isolate the problem or create a repro sample. If so, I suggest you
contact
> > our PSS (product support service) to have one support engineer specially > > help you on it. If you need help on contacting PSS, please feel free to > > post here and I will post back with detailed information.
> >
> > If you have any more concerns on it, please feel free to post here.
Thanks
> > very much and look forward to your response.
> >
> > Best regards,
> > Yanhong Huang
> > Microsoft Community Support
> >
> > Get Secure! 每 www.microsoft.com/security
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> --
> Bret Pehrson
> mailto:br**@infowest.com
> NOSPAM - Include this key in all e-mail correspondence

<<38952rglkwdsl>>

--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>


--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl>>
Nov 17 '05 #10

P: n/a
Hi Bret,

Thanks very much for your positive feedback. Ronald and I are all glad to
know that you are satisfied with the service here. We are here to support
you at your convenience.

Thanks again for participating the community.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! 每 www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #11

P: n/a
Bret Pehrson wrote:
Ronald -- thanks for the response & comments. I (as well as others)
appreciate the insight that you provide on the reasons for the
issues, as well as a commitment to clarify/resolve/fix the issue.

I've got to tell you, I'm *very* impressed w/ the response that I've
been getting to my issues from Microsoft. I've been out of the
newsgroup community for the past couple of years, but before I left,
typical MS response to just about any issue was: "That is a known
issue and will be fixed in a future release. <end>". It is readily
apparent that you all have made a concerted commitment to better
handle issues, questions, and comments through the newsgroups, and it
is greatly appreciated.
The response from MS in these NGs is in inverse proportion to the service
packs put out for VS Studio .NET, which so far has been 0 . While I too
appreciate the response to reported problems and bugs by MS, I don't
appreciate at all the fact that MS seems to think that end users must
persevere with these problems and onerous workarounds for years at a time
until they come up with a new release, and no doubt new bugs. I would much
rather see service packs which actually fixed some of the problems which are
reported and acknowledge, making it easier to program without having to
memorize all the bugs to be a successful MC++ or C# programmer.

Bret

"Ronald Laeremans [MSFT]" wrote:

Hi Bret,

I agree that the linker error you get in the VC 7.1 release is very
far from ideal. You are seeing some growing pains of fitting a
separate compilation model language like C++ into the CLR
environment. We knew this issue going into the release of VC 7.1,
but the code base we had worked with compiling to IJW internally and
from the early adopters we got most feedback from didn't have a
large number of occurrences of this issue, so we traded improving
this off for other priority fixes. Subsequent experience both
internally and externally has shown it to be quite prevalent though.
We have been working on getting a KB out on this. I'll check on the
status of that.

I am also sorry for my _very_ terse explanation on how to use ildasm
and I am glad you still were able to figure it out. We'll make sure
your comments on ildasm get to the author of that tool.

Ronald

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
Ronald -- thanks for the reply. (Please note, none of my comments
are meant as a personal attack on you.)

In the Whidbey release the linker will give better diagnostics.

I still stand by my previous post where I say it will be at least
the 4th release of the product before it is truly usable in a
commercial environment.

For now the way to diagnose this is using ildasm to dump the
metadata of the .obj files to text and then search for the tokens
(the hex numbers mentioned in the error messages). Usually this is
a source error where 2 translation units define a type in a
different way.

Thanks for defining the mystery error. I was *finally* able to
find the source of the problem and resolve it using the technique
you describe -- thanks. My comments follow for the purpose of
actually documenting the procedure:

First, ILDASM is a mixed-mode application meaning that it has a
GUI-mode and console-mode interface.

When running in GUI mode, you *CANNOT* process .obj files (the only
files that are documented are .exe and .dll). This means that you
must use the tool from the command line (with the appropriate vars
set through vsvars32.bat or by running "Visual Studio .NET 2003
Command Prompt" from the VS.NET start menu tools group).

When processing .obj files from the command line, YOU MUST REDIRECT
THE OUTPUT TO A FILE or else you will get no results - BUG! BUG!
Additionally, you must use the /text option to force output to the
console. So, it boils down to:

ildasm your_source_file.obj /text /out=output.txt

The file output.txt is then created -- open it up and then search
for the token in question (the last hex number of the "Custom
attributes are not consistent" error. (NOTE: the output token
identifiers *DO NOT* prefix hex numbers w/ the traditional 0x -- so
take this into account when searching for the token.) This will
locate the custom attribute of the token that is causing the error.
Once you know the token, it should be relatively easy to locate the
actual source of the problem.

So, presuming the following errors:

Assignment.obj : error LNK2022: metadata operation failed
(80131195) : Custom attributes are not consistent: (0x0c0001a5).

The steps would be:

ildasm Assignment.obj /text /out=assignment.txt

Search assignment.txt for "0c0001a5". It should find some custom
attribute, look up a few lines and locate the offending type.
Armed with that, you can go back to your source files and determine
why the type (class/struct) is being defined differently in the
different source files.

NOTE TO MICROSOFT: Fix this stupid diagnostic! At the *BARE
MINIMUM*, the offending TYPE and ATTRIBUTE should be displayed *BY
NAME* -- hex tokens in diagnostics went out w/ Lattice C compilers
and powdered wigs, they have *ABSOLUTELY NO BUSINESS IN A 7TH-PLUS
GENERATION PRODUCT*

Ronald Laeremans
Visual C++ team

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
> Hmmm...
>
> (I'm presuming that you work for/at Microsoft, or have internal
> contact w/ MS.)
>
> Could you contact the compiler group and have them document the
> metadata "Custom
> attributes are not consistent" error?
>
> Thanks
>
> "Yan-Hong Huang[MSFT]" wrote:
>>
>> Hello Bret,
>>
>> Thanks for posting in the group.
>>
>> Based on my understanding, the problem is: You are migrating an
>> old C++ library project to managed C++ project. However, when
>> you build the project, you got several error LNK2022: metadata
>> operation failed (80131195) link error. Please let me know if I
>> have misunderstood the problem.
>>
>> I searched in our database immediately when I saw your post.
>> Unluckily, the hits are small. And it seems that there were no
>> similar report before. So we can't tell exactly where the
>> problem may reside now.
>>
>> In order to troubleshoot the problem, could you please provide
>> us a small repro sample? We will look into it and reply with
>> detailed information here. You can reach me by removing online
>> from my email address here.
>>
>> I understand that C++ library is not trivial. Perhaps it is hard
>> for you to isolate the problem or create a repro sample. If so,
>> I suggest you contact our PSS (product support service) to have
>> one support engineer specially help you on it. If you need help
>> on contacting PSS, please feel free to post here and I will post
>> back with detailed information.
>>
>> If you have any more concerns on it, please feel free to post
>> here. Thanks very much and look forward to your response.
>>
>> Best regards,
>> Yanhong Huang
>> Microsoft Community Support
>>
>> Get Secure! 每 www.microsoft.com/security
>> This posting is provided "AS IS" with no warranties, and confers
>> no rights.
>
> --
> Bret Pehrson
> mailto:br**@infowest.com
> NOSPAM - Include this key in all e-mail correspondence
> <<38952rglkwdsl>>

--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence
<<38952rglkwdsl>>

Nov 17 '05 #12

P: n/a
This specific issue would not be a service pack level fix. It requires a
quite substantive change. And it strictly isn't a bug rather than a (very
useful) feature that is missing. One of the problems with service packs is
the level of expectation that many customers have on them is significantly
higher than what we can realistically do in a service pack. The timing of
them is of course another issue.

Ronald

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Bret Pehrson wrote:
Ronald -- thanks for the response & comments. I (as well as others)
appreciate the insight that you provide on the reasons for the
issues, as well as a commitment to clarify/resolve/fix the issue.

I've got to tell you, I'm *very* impressed w/ the response that I've
been getting to my issues from Microsoft. I've been out of the
newsgroup community for the past couple of years, but before I left,
typical MS response to just about any issue was: "That is a known
issue and will be fixed in a future release. <end>". It is readily
apparent that you all have made a concerted commitment to better
handle issues, questions, and comments through the newsgroups, and it
is greatly appreciated.
The response from MS in these NGs is in inverse proportion to the service
packs put out for VS Studio .NET, which so far has been 0 . While I too
appreciate the response to reported problems and bugs by MS, I don't
appreciate at all the fact that MS seems to think that end users must
persevere with these problems and onerous workarounds for years at a time
until they come up with a new release, and no doubt new bugs. I would much
rather see service packs which actually fixed some of the problems which

are reported and acknowledge, making it easier to program without having to
memorize all the bugs to be a successful MC++ or C# programmer.

Bret

"Ronald Laeremans [MSFT]" wrote:

Hi Bret,

I agree that the linker error you get in the VC 7.1 release is very
far from ideal. You are seeing some growing pains of fitting a
separate compilation model language like C++ into the CLR
environment. We knew this issue going into the release of VC 7.1,
but the code base we had worked with compiling to IJW internally and
from the early adopters we got most feedback from didn't have a
large number of occurrences of this issue, so we traded improving
this off for other priority fixes. Subsequent experience both
internally and externally has shown it to be quite prevalent though.
We have been working on getting a KB out on this. I'll check on the
status of that.

I am also sorry for my _very_ terse explanation on how to use ildasm
and I am glad you still were able to figure it out. We'll make sure
your comments on ildasm get to the author of that tool.

Ronald

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
Ronald -- thanks for the reply. (Please note, none of my comments
are meant as a personal attack on you.)

> In the Whidbey release the linker will give better diagnostics.

I still stand by my previous post where I say it will be at least
the 4th release of the product before it is truly usable in a
commercial environment.

> For now the way to diagnose this is using ildasm to dump the
> metadata of the .obj files to text and then search for the tokens
> (the hex numbers mentioned in the error messages). Usually this is
> a source error where 2 translation units define a type in a
> different way.

Thanks for defining the mystery error. I was *finally* able to
find the source of the problem and resolve it using the technique
you describe -- thanks. My comments follow for the purpose of
actually documenting the procedure:

First, ILDASM is a mixed-mode application meaning that it has a
GUI-mode and console-mode interface.

When running in GUI mode, you *CANNOT* process .obj files (the only
files that are documented are .exe and .dll). This means that you
must use the tool from the command line (with the appropriate vars
set through vsvars32.bat or by running "Visual Studio .NET 2003
Command Prompt" from the VS.NET start menu tools group).

When processing .obj files from the command line, YOU MUST REDIRECT
THE OUTPUT TO A FILE or else you will get no results - BUG! BUG!
Additionally, you must use the /text option to force output to the
console. So, it boils down to:

ildasm your_source_file.obj /text /out=output.txt

The file output.txt is then created -- open it up and then search
for the token in question (the last hex number of the "Custom
attributes are not consistent" error. (NOTE: the output token
identifiers *DO NOT* prefix hex numbers w/ the traditional 0x -- so
take this into account when searching for the token.) This will
locate the custom attribute of the token that is causing the error.
Once you know the token, it should be relatively easy to locate the
actual source of the problem.

So, presuming the following errors:

Assignment.obj : error LNK2022: metadata operation failed
(80131195) : Custom attributes are not consistent: (0x0c0001a5).

The steps would be:

ildasm Assignment.obj /text /out=assignment.txt

Search assignment.txt for "0c0001a5". It should find some custom
attribute, look up a few lines and locate the offending type.
Armed with that, you can go back to your source files and determine
why the type (class/struct) is being defined differently in the
different source files.

NOTE TO MICROSOFT: Fix this stupid diagnostic! At the *BARE
MINIMUM*, the offending TYPE and ATTRIBUTE should be displayed *BY
NAME* -- hex tokens in diagnostics went out w/ Lattice C compilers
and powdered wigs, they have *ABSOLUTELY NO BUSINESS IN A 7TH-PLUS
GENERATION PRODUCT*
>
> Ronald Laeremans
> Visual C++ team
>
> "Bret Pehrson" <br**@infowest.com> wrote in message
> news:40***************@infowest.com...
>> Hmmm...
>>
>> (I'm presuming that you work for/at Microsoft, or have internal
>> contact w/ MS.)
>>
>> Could you contact the compiler group and have them document the
>> metadata "Custom
>> attributes are not consistent" error?
>>
>> Thanks
>>
>> "Yan-Hong Huang[MSFT]" wrote:
>>>
>>> Hello Bret,
>>>
>>> Thanks for posting in the group.
>>>
>>> Based on my understanding, the problem is: You are migrating an
>>> old C++ library project to managed C++ project. However, when
>>> you build the project, you got several error LNK2022: metadata
>>> operation failed (80131195) link error. Please let me know if I
>>> have misunderstood the problem.
>>>
>>> I searched in our database immediately when I saw your post.
>>> Unluckily, the hits are small. And it seems that there were no
>>> similar report before. So we can't tell exactly where the
>>> problem may reside now.
>>>
>>> In order to troubleshoot the problem, could you please provide
>>> us a small repro sample? We will look into it and reply with
>>> detailed information here. You can reach me by removing online
>>> from my email address here.
>>>
>>> I understand that C++ library is not trivial. Perhaps it is hard
>>> for you to isolate the problem or create a repro sample. If so,
>>> I suggest you contact our PSS (product support service) to have
>>> one support engineer specially help you on it. If you need help
>>> on contacting PSS, please feel free to post here and I will post
>>> back with detailed information.
>>>
>>> If you have any more concerns on it, please feel free to post
>>> here. Thanks very much and look forward to your response.
>>>
>>> Best regards,
>>> Yanhong Huang
>>> Microsoft Community Support
>>>
>>> Get Secure! 每 www.microsoft.com/security
>>> This posting is provided "AS IS" with no warranties, and confers
>>> no rights.
>>
>> --
>> Bret Pehrson
>> mailto:br**@infowest.com
>> NOSPAM - Include this key in all e-mail correspondence
>> <<38952rglkwdsl>>

--
Bret Pehrson
mailto:br**@infowest.com
NOSPAM - Include this key in all e-mail correspondence
<<38952rglkwdsl>>


Nov 17 '05 #13

P: n/a
Ronald Laeremans [MSFT] wrote:
This specific issue would not be a service pack level fix. It
requires a quite substantive change. And it strictly isn't a bug
rather than a (very useful) feature that is missing. One of the
problems with service packs is the level of expectation that many
customers have on them is significantly higher than what we can
realistically do in a service pack. The timing of them is of course
another issue.
You're excuses for not putting out a service pack are too transparent for
anyone of intelligence, and certainly doesn't fool this one. Nor will I
waste time trying to argue against your feeble spin.

If MS doesn't want to put out service packs anymore for Visual Studio, that
is their business, but it is not a proper way to support current customers
who must use your product, to consistently tell them that a bug has been
fixed for the next release of Visual Studio while they are looking for
reasonable solutions on this release. Your help, and that of other employees
of MS, in finding workarounds and solutions to current bugs is appreciated
on these NGs, but MS's new policy of not fixing bugs for the current release
can not endear your company to its customers.

Ronald

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Bret Pehrson wrote:
Ronald -- thanks for the response & comments. I (as well as others)
appreciate the insight that you provide on the reasons for the
issues, as well as a commitment to clarify/resolve/fix the issue.

I've got to tell you, I'm *very* impressed w/ the response that I've
been getting to my issues from Microsoft. I've been out of the
newsgroup community for the past couple of years, but before I left,
typical MS response to just about any issue was: "That is a known
issue and will be fixed in a future release. <end>". It is readily
apparent that you all have made a concerted commitment to better
handle issues, questions, and comments through the newsgroups, and
it is greatly appreciated.


The response from MS in these NGs is in inverse proportion to the
service packs put out for VS Studio .NET, which so far has been 0 .
While I too appreciate the response to reported problems and bugs by
MS, I don't appreciate at all the fact that MS seems to think that
end users must persevere with these problems and onerous workarounds
for years at a time until they come up with a new release, and no
doubt new bugs. I would much rather see service packs which actually
fixed some of the problems which are reported and acknowledge,
making it easier to program without having to memorize all the bugs
to be a successful MC++ or C# programmer.

Bret

"Ronald Laeremans [MSFT]" wrote:

Hi Bret,

I agree that the linker error you get in the VC 7.1 release is very
far from ideal. You are seeing some growing pains of fitting a
separate compilation model language like C++ into the CLR
environment. We knew this issue going into the release of VC 7.1,
but the code base we had worked with compiling to IJW internally
and from the early adopters we got most feedback from didn't have a
large number of occurrences of this issue, so we traded improving
this off for other priority fixes. Subsequent experience both
internally and externally has shown it to be quite prevalent
though. We have been working on getting a KB out on this. I'll
check on the status of that.

I am also sorry for my _very_ terse explanation on how to use
ildasm and I am glad you still were able to figure it out. We'll
make sure your comments on ildasm get to the author of that tool.

Ronald

"Bret Pehrson" <br**@infowest.com> wrote in message
news:40***************@infowest.com...
> Ronald -- thanks for the reply. (Please note, none of my comments
> are meant as a personal attack on you.)
>
>> In the Whidbey release the linker will give better diagnostics.
>
> I still stand by my previous post where I say it will be at least
> the 4th release of the product before it is truly usable in a
> commercial environment.
>
>> For now the way to diagnose this is using ildasm to dump the
>> metadata of the .obj files to text and then search for the tokens
>> (the hex numbers mentioned in the error messages). Usually this
>> is a source error where 2 translation units define a type in a
>> different way.
>
> Thanks for defining the mystery error. I was *finally* able to
> find the source of the problem and resolve it using the technique
> you describe -- thanks. My comments follow for the purpose of
> actually documenting the procedure:
>
> First, ILDASM is a mixed-mode application meaning that it has a
> GUI-mode and console-mode interface.
>
> When running in GUI mode, you *CANNOT* process .obj files (the
> only files that are documented are .exe and .dll). This means
> that you must use the tool from the command line (with the
> appropriate vars set through vsvars32.bat or by running "Visual
> Studio .NET 2003 Command Prompt" from the VS.NET start menu tools
> group).
>
> When processing .obj files from the command line, YOU MUST
> REDIRECT THE OUTPUT TO A FILE or else you will get no results -
> BUG! BUG! Additionally, you must use the /text option to force
> output to the console. So, it boils down to:
>
> ildasm your_source_file.obj /text /out=output.txt
>
> The file output.txt is then created -- open it up and then search
> for the token in question (the last hex number of the "Custom
> attributes are not consistent" error. (NOTE: the output token
> identifiers *DO NOT* prefix hex numbers w/ the traditional 0x --
> so take this into account when searching for the token.) This will
> locate the custom attribute of the token that is causing the
> error. Once you know the token, it should be relatively easy to
> locate the actual source of the problem.
>
> So, presuming the following errors:
>
> Assignment.obj : error LNK2022: metadata operation failed
> (80131195) : Custom attributes are not consistent: (0x0c0001a5).
>
> The steps would be:
>
> ildasm Assignment.obj /text /out=assignment.txt
>
> Search assignment.txt for "0c0001a5". It should find some custom
> attribute, look up a few lines and locate the offending type.
> Armed with that, you can go back to your source files and
> determine why the type (class/struct) is being defined
> differently in the different source files.
>
> NOTE TO MICROSOFT: Fix this stupid diagnostic! At the *BARE
> MINIMUM*, the offending TYPE and ATTRIBUTE should be displayed *BY
> NAME* -- hex tokens in diagnostics went out w/ Lattice C compilers
> and powdered wigs, they have *ABSOLUTELY NO BUSINESS IN A 7TH-PLUS
> GENERATION PRODUCT*
>
>
>>
>> Ronald Laeremans
>> Visual C++ team
>>
>> "Bret Pehrson" <br**@infowest.com> wrote in message
>> news:40***************@infowest.com...
>>> Hmmm...
>>>
>>> (I'm presuming that you work for/at Microsoft, or have internal
>>> contact w/ MS.)
>>>
>>> Could you contact the compiler group and have them document the
>>> metadata "Custom
>>> attributes are not consistent" error?
>>>
>>> Thanks
>>>
>>> "Yan-Hong Huang[MSFT]" wrote:
>>>>
>>>> Hello Bret,
>>>>
>>>> Thanks for posting in the group.
>>>>
>>>> Based on my understanding, the problem is: You are migrating an
>>>> old C++ library project to managed C++ project. However, when
>>>> you build the project, you got several error LNK2022: metadata
>>>> operation failed (80131195) link error. Please let me know if I
>>>> have misunderstood the problem.
>>>>
>>>> I searched in our database immediately when I saw your post.
>>>> Unluckily, the hits are small. And it seems that there were no
>>>> similar report before. So we can't tell exactly where the
>>>> problem may reside now.
>>>>
>>>> In order to troubleshoot the problem, could you please provide
>>>> us a small repro sample? We will look into it and reply with
>>>> detailed information here. You can reach me by removing online
>>>> from my email address here.
>>>>
>>>> I understand that C++ library is not trivial. Perhaps it is
>>>> hard for you to isolate the problem or create a repro sample.
>>>> If so, I suggest you contact our PSS (product support service)
>>>> to have one support engineer specially help you on it. If you
>>>> need help on contacting PSS, please feel free to post here and
>>>> I will post back with detailed information.
>>>>
>>>> If you have any more concerns on it, please feel free to post
>>>> here. Thanks very much and look forward to your response.
>>>>
>>>> Best regards,
>>>> Yanhong Huang
>>>> Microsoft Community Support
>>>>
>>>> Get Secure! 每 www.microsoft.com/security
>>>> This posting is provided "AS IS" with no warranties, and
>>>> confers no rights.
>>>
>>> --
>>> Bret Pehrson
>>> mailto:br**@infowest.com
>>> NOSPAM - Include this key in all e-mail correspondence
>>> <<38952rglkwdsl>>
>
> --
> Bret Pehrson
> mailto:br**@infowest.com
> NOSPAM - Include this key in all e-mail correspondence
> <<38952rglkwdsl>>

Nov 17 '05 #14

P: n/a
Hi Edward,

Our policy on service packs has not changed over the last decade. The only
time Visual C++ has ever done what you are asking for is with the VC 4.x
subscription releases that contained not just critical bug fixes, but also
non critical bug fixes new features or 'issue fixes' that we were able to do
in a limited timeframe.

All other times the SP policy for VC and other components of Visual Studio
has been fixing critical bugs in the product.

As for VS 2002, I feel very strongly that we made the right call by focusing
on the VS 2003 release instead of on the SP for VS 2002 so that we could
deliver at least 2 orders of magnitude more improvements (both bug fixes,
addressing larger issues and doing new features) on a short timeline and
make that product available at a trivial cost (of $29 for the upgrade
offer).

Ronald

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:eb**************@TK2MSFTNGP11.phx.gbl...
Ronald Laeremans [MSFT] wrote:
This specific issue would not be a service pack level fix. It
requires a quite substantive change. And it strictly isn't a bug
rather than a (very useful) feature that is missing. One of the
problems with service packs is the level of expectation that many
customers have on them is significantly higher than what we can
realistically do in a service pack. The timing of them is of course
another issue.
You're excuses for not putting out a service pack are too transparent for
anyone of intelligence, and certainly doesn't fool this one. Nor will I
waste time trying to argue against your feeble spin.

If MS doesn't want to put out service packs anymore for Visual Studio,

that is their business, but it is not a proper way to support current customers
who must use your product, to consistently tell them that a bug has been
fixed for the next release of Visual Studio while they are looking for
reasonable solutions on this release. Your help, and that of other employees of MS, in finding workarounds and solutions to current bugs is appreciated
on these NGs, but MS's new policy of not fixing bugs for the current release can not endear your company to its customers.

Ronald

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Bret Pehrson wrote:
Ronald -- thanks for the response & comments. I (as well as others)
appreciate the insight that you provide on the reasons for the
issues, as well as a commitment to clarify/resolve/fix the issue.

I've got to tell you, I'm *very* impressed w/ the response that I've
been getting to my issues from Microsoft. I've been out of the
newsgroup community for the past couple of years, but before I left,
typical MS response to just about any issue was: "That is a known
issue and will be fixed in a future release. <end>". It is readily
apparent that you all have made a concerted commitment to better
handle issues, questions, and comments through the newsgroups, and
it is greatly appreciated.

The response from MS in these NGs is in inverse proportion to the
service packs put out for VS Studio .NET, which so far has been 0 .
While I too appreciate the response to reported problems and bugs by
MS, I don't appreciate at all the fact that MS seems to think that
end users must persevere with these problems and onerous workarounds
for years at a time until they come up with a new release, and no
doubt new bugs. I would much rather see service packs which actually
fixed some of the problems which are reported and acknowledge,
making it easier to program without having to memorize all the bugs
to be a successful MC++ or C# programmer.
Bret

"Ronald Laeremans [MSFT]" wrote:
>
> Hi Bret,
>
> I agree that the linker error you get in the VC 7.1 release is very
> far from ideal. You are seeing some growing pains of fitting a
> separate compilation model language like C++ into the CLR
> environment. We knew this issue going into the release of VC 7.1,
> but the code base we had worked with compiling to IJW internally
> and from the early adopters we got most feedback from didn't have a
> large number of occurrences of this issue, so we traded improving
> this off for other priority fixes. Subsequent experience both
> internally and externally has shown it to be quite prevalent
> though. We have been working on getting a KB out on this. I'll
> check on the status of that.
>
> I am also sorry for my _very_ terse explanation on how to use
> ildasm and I am glad you still were able to figure it out. We'll
> make sure your comments on ildasm get to the author of that tool.
>
> Ronald
>
> "Bret Pehrson" <br**@infowest.com> wrote in message
> news:40***************@infowest.com...
>> Ronald -- thanks for the reply. (Please note, none of my comments
>> are meant as a personal attack on you.)
>>
>>> In the Whidbey release the linker will give better diagnostics.
>>
>> I still stand by my previous post where I say it will be at least
>> the 4th release of the product before it is truly usable in a
>> commercial environment.
>>
>>> For now the way to diagnose this is using ildasm to dump the
>>> metadata of the .obj files to text and then search for the tokens
>>> (the hex numbers mentioned in the error messages). Usually this
>>> is a source error where 2 translation units define a type in a
>>> different way.
>>
>> Thanks for defining the mystery error. I was *finally* able to
>> find the source of the problem and resolve it using the technique
>> you describe -- thanks. My comments follow for the purpose of
>> actually documenting the procedure:
>>
>> First, ILDASM is a mixed-mode application meaning that it has a
>> GUI-mode and console-mode interface.
>>
>> When running in GUI mode, you *CANNOT* process .obj files (the
>> only files that are documented are .exe and .dll). This means
>> that you must use the tool from the command line (with the
>> appropriate vars set through vsvars32.bat or by running "Visual
>> Studio .NET 2003 Command Prompt" from the VS.NET start menu tools
>> group).
>>
>> When processing .obj files from the command line, YOU MUST
>> REDIRECT THE OUTPUT TO A FILE or else you will get no results -
>> BUG! BUG! Additionally, you must use the /text option to force
>> output to the console. So, it boils down to:
>>
>> ildasm your_source_file.obj /text /out=output.txt
>>
>> The file output.txt is then created -- open it up and then search
>> for the token in question (the last hex number of the "Custom
>> attributes are not consistent" error. (NOTE: the output token
>> identifiers *DO NOT* prefix hex numbers w/ the traditional 0x --
>> so take this into account when searching for the token.) This will
>> locate the custom attribute of the token that is causing the
>> error. Once you know the token, it should be relatively easy to
>> locate the actual source of the problem.
>>
>> So, presuming the following errors:
>>
>> Assignment.obj : error LNK2022: metadata operation failed
>> (80131195) : Custom attributes are not consistent: (0x0c0001a5).
>>
>> The steps would be:
>>
>> ildasm Assignment.obj /text /out=assignment.txt
>>
>> Search assignment.txt for "0c0001a5". It should find some custom
>> attribute, look up a few lines and locate the offending type.
>> Armed with that, you can go back to your source files and
>> determine why the type (class/struct) is being defined
>> differently in the different source files.
>>
>> NOTE TO MICROSOFT: Fix this stupid diagnostic! At the *BARE
>> MINIMUM*, the offending TYPE and ATTRIBUTE should be displayed *BY
>> NAME* -- hex tokens in diagnostics went out w/ Lattice C compilers
>> and powdered wigs, they have *ABSOLUTELY NO BUSINESS IN A 7TH-PLUS
>> GENERATION PRODUCT*
>>
>>
>>>
>>> Ronald Laeremans
>>> Visual C++ team
>>>
>>> "Bret Pehrson" <br**@infowest.com> wrote in message
>>> news:40***************@infowest.com...
>>>> Hmmm...
>>>>
>>>> (I'm presuming that you work for/at Microsoft, or have internal
>>>> contact w/ MS.)
>>>>
>>>> Could you contact the compiler group and have them document the
>>>> metadata "Custom
>>>> attributes are not consistent" error?
>>>>
>>>> Thanks
>>>>
>>>> "Yan-Hong Huang[MSFT]" wrote:
>>>>>
>>>>> Hello Bret,
>>>>>
>>>>> Thanks for posting in the group.
>>>>>
>>>>> Based on my understanding, the problem is: You are migrating an
>>>>> old C++ library project to managed C++ project. However, when
>>>>> you build the project, you got several error LNK2022: metadata
>>>>> operation failed (80131195) link error. Please let me know if I
>>>>> have misunderstood the problem.
>>>>>
>>>>> I searched in our database immediately when I saw your post.
>>>>> Unluckily, the hits are small. And it seems that there were no
>>>>> similar report before. So we can't tell exactly where the
>>>>> problem may reside now.
>>>>>
>>>>> In order to troubleshoot the problem, could you please provide
>>>>> us a small repro sample? We will look into it and reply with
>>>>> detailed information here. You can reach me by removing online
>>>>> from my email address here.
>>>>>
>>>>> I understand that C++ library is not trivial. Perhaps it is
>>>>> hard for you to isolate the problem or create a repro sample.
>>>>> If so, I suggest you contact our PSS (product support service)
>>>>> to have one support engineer specially help you on it. If you
>>>>> need help on contacting PSS, please feel free to post here and
>>>>> I will post back with detailed information.
>>>>>
>>>>> If you have any more concerns on it, please feel free to post
>>>>> here. Thanks very much and look forward to your response.
>>>>>
>>>>> Best regards,
>>>>> Yanhong Huang
>>>>> Microsoft Community Support
>>>>>
>>>>> Get Secure! 每 www.microsoft.com/security
>>>>> This posting is provided "AS IS" with no warranties, and
>>>>> confers no rights.
>>>>
>>>> --
>>>> Bret Pehrson
>>>> mailto:br**@infowest.com
>>>> NOSPAM - Include this key in all e-mail correspondence
>>>> <<38952rglkwdsl>>
>>
>> --
>> Bret Pehrson
>> mailto:br**@infowest.com
>> NOSPAM - Include this key in all e-mail correspondence
>> <<38952rglkwdsl>>


Nov 17 '05 #15

P: n/a
Ronald Laeremans [MSFT] wrote:
Hi Edward,

Our policy on service packs has not changed over the last decade. The
only time Visual C++ has ever done what you are asking for is with
the VC 4.x subscription releases that contained not just critical bug
fixes, but also non critical bug fixes new features or 'issue fixes'
that we were able to do in a limited timeframe.

All other times the SP policy for VC and other components of Visual
Studio has been fixing critical bugs in the product.

As for VS 2002, I feel very strongly that we made the right call by
focusing on the VS 2003 release instead of on the SP for VS 2002 so
that we could deliver at least 2 orders of magnitude more
improvements (both bug fixes, addressing larger issues and doing new
features) on a short timeline and make that product available at a
trivial cost (of $29 for the upgrade offer).
Microsoft put out five service packs for VS6 and you have put out none for
VS .NET. Based on that it is very hard to believe that MS's policy on
service packs has not changed over the last decade. There is an obvious
critical bug with MC++ which is very well documented by MS, said to be fixed
with Whidbey, regarding mixed mode MC++ and assembly startup. There are
other serious bugs, especially with MC++ ( I reported one personal
showstopper recently for which I still have not gotten back a solution ),
and there are other bugs as this thread shows. What MS deems to be critical
is your own choice but I interpret MS's inability to get out needed service
packs for VS .NET as the usual monetary situation, meaning that you want to
be paid for fixing bugs in your own product via a new release and a new
revenue stream. Also I am sure that service packs for VS6 fixed many
problems which may not have been critical but which were highly irritating,
burdensome, and time consuming for programmers not only to encounter and
verify but to find a workaround for.

You can justify your company's policy regarding service packs for VS .NET
however if you like, but it is just that to me; a justification from a
company employee and not a fair technical assessment of the need to update
your product to make it easier for others to use it. I am sure I am not the
only programmer using VS .NET who feels that MS should put out service packs
for the product, just like they did for VS6, to fix problems and let
programmers get on with their work. Being told that a particular problem is
fixed for the next release is nice, but that does not help people working
with the current release who are producing critical software.

Ronald

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:eb**************@TK2MSFTNGP11.phx.gbl...
Ronald Laeremans [MSFT] wrote:
This specific issue would not be a service pack level fix. It
requires a quite substantive change. And it strictly isn't a bug
rather than a (very useful) feature that is missing. One of the
problems with service packs is the level of expectation that many
customers have on them is significantly higher than what we can
realistically do in a service pack. The timing of them is of course
another issue.


You're excuses for not putting out a service pack are too
transparent for anyone of intelligence, and certainly doesn't fool
this one. Nor will I waste time trying to argue against your feeble
spin.

If MS doesn't want to put out service packs anymore for Visual
Studio, that is their business, but it is not a proper way to
support current customers who must use your product, to consistently
tell them that a bug has been fixed for the next release of Visual
Studio while they are looking for reasonable solutions on this
release. Your help, and that of other employees of MS, in finding
workarounds and solutions to current bugs is appreciated on these
NGs, but MS's new policy of not fixing bugs for the current release
can not endear your company to its customers.

Ronald

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Bret Pehrson wrote:
> Ronald -- thanks for the response & comments. I (as well as
> others) appreciate the insight that you provide on the reasons
> for the issues, as well as a commitment to clarify/resolve/fix
> the issue.
>
> I've got to tell you, I'm *very* impressed w/ the response that
> I've been getting to my issues from Microsoft. I've been out of
> the newsgroup community for the past couple of years, but before
> I left, typical MS response to just about any issue was: "That is
> a known issue and will be fixed in a future release. <end>". It
> is readily apparent that you all have made a concerted commitment
> to better handle issues, questions, and comments through the
> newsgroups, and it is greatly appreciated.

The response from MS in these NGs is in inverse proportion to the
service packs put out for VS Studio .NET, which so far has been 0 .
While I too appreciate the response to reported problems and bugs
by MS, I don't appreciate at all the fact that MS seems to think
that end users must persevere with these problems and onerous
workarounds for years at a time until they come up with a new
release, and no doubt new bugs. I would much rather see service
packs which actually fixed some of the problems which are reported
and acknowledge, making it easier to program without having to
memorize all the bugs to be a successful MC++ or C# programmer.

>
> Bret
>
> "Ronald Laeremans [MSFT]" wrote:
>>
>> Hi Bret,
>>
>> I agree that the linker error you get in the VC 7.1 release is
>> very far from ideal. You are seeing some growing pains of
>> fitting a separate compilation model language like C++ into the
>> CLR environment. We knew this issue going into the release of VC
>> 7.1, but the code base we had worked with compiling to IJW
>> internally and from the early adopters we got most feedback from
>> didn't have a large number of occurrences of this issue, so we
>> traded improving this off for other priority fixes. Subsequent
>> experience both internally and externally has shown it to be
>> quite prevalent though. We have been working on getting a KB out
>> on this. I'll check on the status of that.
>>
>> I am also sorry for my _very_ terse explanation on how to use
>> ildasm and I am glad you still were able to figure it out. We'll
>> make sure your comments on ildasm get to the author of that tool.
>>
>> Ronald
>>
>> "Bret Pehrson" <br**@infowest.com> wrote in message
>> news:40***************@infowest.com...
>>> Ronald -- thanks for the reply. (Please note, none of my
>>> comments are meant as a personal attack on you.)
>>>
>>>> In the Whidbey release the linker will give better diagnostics.
>>>
>>> I still stand by my previous post where I say it will be at
>>> least the 4th release of the product before it is truly usable
>>> in a commercial environment.
>>>
>>>> For now the way to diagnose this is using ildasm to dump the
>>>> metadata of the .obj files to text and then search for the
>>>> tokens (the hex numbers mentioned in the error messages).
>>>> Usually this is a source error where 2 translation units
>>>> define a type in a different way.
>>>
>>> Thanks for defining the mystery error. I was *finally* able to
>>> find the source of the problem and resolve it using the
>>> technique you describe -- thanks. My comments follow for the
>>> purpose of actually documenting the procedure:
>>>
>>> First, ILDASM is a mixed-mode application meaning that it has a
>>> GUI-mode and console-mode interface.
>>>
>>> When running in GUI mode, you *CANNOT* process .obj files (the
>>> only files that are documented are .exe and .dll). This means
>>> that you must use the tool from the command line (with the
>>> appropriate vars set through vsvars32.bat or by running "Visual
>>> Studio .NET 2003 Command Prompt" from the VS.NET start menu
>>> tools group).
>>>
>>> When processing .obj files from the command line, YOU MUST
>>> REDIRECT THE OUTPUT TO A FILE or else you will get no results -
>>> BUG! BUG! Additionally, you must use the /text option to force
>>> output to the console. So, it boils down to:
>>>
>>> ildasm your_source_file.obj /text /out=output.txt
>>>
>>> The file output.txt is then created -- open it up and then
>>> search for the token in question (the last hex number of the
>>> "Custom attributes are not consistent" error. (NOTE: the
>>> output token identifiers *DO NOT* prefix hex numbers w/ the
>>> traditional 0x -- so take this into account when searching for
>>> the token.) This will locate the custom attribute of the token
>>> that is causing the error. Once you know the token, it should
>>> be relatively easy to locate the actual source of the problem.
>>>
>>> So, presuming the following errors:
>>>
>>> Assignment.obj : error LNK2022: metadata operation failed
>>> (80131195) : Custom attributes are not consistent: (0x0c0001a5).
>>>
>>> The steps would be:
>>>
>>> ildasm Assignment.obj /text /out=assignment.txt
>>>
>>> Search assignment.txt for "0c0001a5". It should find some
>>> custom attribute, look up a few lines and locate the offending
>>> type. Armed with that, you can go back to your source files and
>>> determine why the type (class/struct) is being defined
>>> differently in the different source files.
>>>
>>> NOTE TO MICROSOFT: Fix this stupid diagnostic! At the *BARE
>>> MINIMUM*, the offending TYPE and ATTRIBUTE should be displayed
>>> *BY NAME* -- hex tokens in diagnostics went out w/ Lattice C
>>> compilers and powdered wigs, they have *ABSOLUTELY NO BUSINESS
>>> IN A 7TH-PLUS GENERATION PRODUCT*
>>>
>>>
>>>>
>>>> Ronald Laeremans
>>>> Visual C++ team
>>>>
>>>> "Bret Pehrson" <br**@infowest.com> wrote in message
>>>> news:40***************@infowest.com...
>>>>> Hmmm...
>>>>>
>>>>> (I'm presuming that you work for/at Microsoft, or have
>>>>> internal contact w/ MS.)
>>>>>
>>>>> Could you contact the compiler group and have them document
>>>>> the metadata "Custom
>>>>> attributes are not consistent" error?
>>>>>
>>>>> Thanks
>>>>>
>>>>> "Yan-Hong Huang[MSFT]" wrote:
>>>>>>
>>>>>> Hello Bret,
>>>>>>
>>>>>> Thanks for posting in the group.
>>>>>>
>>>>>> Based on my understanding, the problem is: You are migrating
>>>>>> an old C++ library project to managed C++ project. However,
>>>>>> when you build the project, you got several error LNK2022:
>>>>>> metadata operation failed (80131195) link error. Please let
>>>>>> me know if I have misunderstood the problem.
>>>>>>
>>>>>> I searched in our database immediately when I saw your post.
>>>>>> Unluckily, the hits are small. And it seems that there were
>>>>>> no similar report before. So we can't tell exactly where the
>>>>>> problem may reside now.
>>>>>>
>>>>>> In order to troubleshoot the problem, could you please
>>>>>> provide us a small repro sample? We will look into it and
>>>>>> reply with detailed information here. You can reach me by
>>>>>> removing online from my email address here.
>>>>>>
>>>>>> I understand that C++ library is not trivial. Perhaps it is
>>>>>> hard for you to isolate the problem or create a repro sample.
>>>>>> If so, I suggest you contact our PSS (product support
>>>>>> service) to have one support engineer specially help you on
>>>>>> it. If you need help on contacting PSS, please feel free to
>>>>>> post here and I will post back with detailed information.
>>>>>>
>>>>>> If you have any more concerns on it, please feel free to post
>>>>>> here. Thanks very much and look forward to your response.
>>>>>>
>>>>>> Best regards,
>>>>>> Yanhong Huang
>>>>>> Microsoft Community Support
>>>>>>
>>>>>> Get Secure! 每 www.microsoft.com/security
>>>>>> This posting is provided "AS IS" with no warranties, and
>>>>>> confers no rights.
>>>>>
>>>>> --
>>>>> Bret Pehrson
>>>>> mailto:br**@infowest.com
>>>>> NOSPAM - Include this key in all e-mail correspondence
>>>>> <<38952rglkwdsl>>
>>>
>>> --
>>> Bret Pehrson
>>> mailto:br**@infowest.com
>>> NOSPAM - Include this key in all e-mail correspondence
>>> <<38952rglkwdsl>>

Nov 17 '05 #16

P: n/a

My partner and I encountered this problem as well, and while ILDAS
worked, it didn't get us much closer to finding the solution--it looke
like the types that were causing the problem came from libc!

In the end, we discovered that some of our managed C++ project
included *.c files. Setting these files to be unmanaged (in Fil
Properties) fixed the problem
-
James Lair
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message278801.htm

Nov 17 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.