Home Dashboard Directory Help
Search

C++/Cx component producing a corrupt .winmd file by Lloyd


Status: 

Closed
 as Not Reproducible Help for as Not Reproducible


3
0
Sign in
to vote
Type: Bug
ID: 775871
Opened: 1/5/2013 6:43:07 AM
Access Restriction: Public
1
Workaround(s)
view
1
User(s) can reproduce this bug

Description

I have a C++/Cx component which I use in a C# DirectX Metro app.
It worked fine.
until my latest innocuous changes.. where my C# project can't use the C++/Cx project anymore, I got this error:
"There was a problem reading metadata from 'C:\Dev\WinRTDirectXSamples\Debug\DXBase\DXBase.winmd' ('An attempt was made to load a program with an incorrect format.')."

Reverting the changes made it work
(only a few properties / method in the C++ component changed, i.e. no project - target architecture changes)
Details
Sign in to post a comment.
Posted by Anders Eggers-Krag on 7/16/2013 at 2:58 PM
I have tried the following to fix the problem:
Deleted every file i could find in the project folder that i had not created, had no effect
Installed a fresh windows 8, and visual studio on a VM, copying only the project same error occurs
Renamed the project file, project and root namespace (edited the vcxproj and sln files manually) this cuases the error to go away and also causes the winmd file to grow by about 2 kB (i will attach both winmd files)
returning to the original project name causes the error to return.

It should be noted that the former project name has worked for months and hundreds of compiles prior to the error occurring (if the number of files in \AppData\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache is anything to go by it has worked for over 500 compiles, which i might add caused that folder to take up 10 GB of disk space, over 500 22 MB pdb files)

Also the error has occured several times previously but in all cases a full rebuild was sufficient, this time it had no effect.

I will leave the VM with the failing project intact in case you need more information
Posted by Microsoft on 1/10/2013 at 1:44 AM
Hi lloyd, thanks for submitting feedback on Visual Studio and .Net Framework. We'll close this issue because you have found a workaround. Thanks for your time.
Posted by Lloyd on 1/5/2013 at 7:00 AM
I found a weird work around:

On a wild hunch (it's a compiler problem, right? I though I'll try to help it)
There was 2 properties in DXContext defined with a macro (TargetType, Status), I got rid of the macro and used code instead and then it worked fine!
Posted by Microsoft on 1/5/2013 at 6:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Anders Eggers-Krag on 7/16/2013 at 2:41 PM
I found that renaming the project file, the project, and the root namespace "fixed" it, its not exactly a pretty solution but at least it lets me get back to work.
File Name Submitted By Submitted On File Size  
VS2012bug.zip 1/5/2013 481 KB
ScanApps.GamePlatform.zip (restricted) 7/16/2013 -