I'm trying to debug a c++ project in visual studio 2012 and when attempting to view a string value I get the error 'Error reading characters of string.'.
The only relevant article I can find is here:
http://connect.microsoft.com/VisualStudio/feedback/details/721456
but my project has none of the relevant preprocessor options set.
Heres a screenshot to show exactly what I mean
error http://img854.imageshack.us/img854/1682/09112012100524.png
Any help on this error would be much appreciated!
0xcdcdcdcd Is a special marker sequence used in Microsoft debug builds and shows the presence of uninitialized memory:
Well known magic numbers
This rather suggests that you haven't initialized the string inside your AptConstItem.
I had this same issue and it was a problem in my build definitions. I could debug some variables but not others. I had to turn off all optimizations. In C/C++ -> Optimization and Linker -> Optimization.
Related
I have a Visual Studio linker error that popped up recently. I stumbled upon a workaround but it is driving me crazy that I can't figure out why it is happening in the first place. I need to learn how to better diagnose it.
So my question is not about how to fix it, but how to diagnose it better. In short what I'm trying to learn here is how to get the linker (or some other tool) to tell me more info about the problem. So this question is not about this particular enum or how I coded it exactly.
The project is a C++/CLI project I have a managed enum which I wanted to refer to in several other header files. So I tried to put a forward declaration of it in the shared file that I use for all my other forward declarations. That started giving me this error.
1>profileregioncli.obj : error LNK2022: metadata operation failed (801311E4) : Duplicate managed types have different visibilities.
OK, fine. My forward declaration probably looks different to the linker than the definition. But I cannot see how the declarations are different in code. And technically, since the linker doesn't even bother to tell me exactly what type is involved I cannot even be 100% sure it's this enum.
So how do I determine following two things?
Exactly what symbol is mismatching AND
Exactly what is the difference (to the linker) between the two versions.
Obviously the first item I probably know. The second, not at all.
What I have tried so far
I've tried setting linker output to full verbosity but it doesn't tell me anything new. Here is the full linker output
1>------ Build started: Project: Core.Sdk, Configuration: Release x64 ------
1>Generating code
1>0 of 1470 functions ( 0.0%) were compiled, the rest were copied from previous compilation.
1> 0 functions were new in current compilation
1> 0 functions had inline decision re-evaluated but remain unchanged
1>Finished generating code
1>profileregioncli.obj : error LNK2022: metadata operation failed (801311E4) : Duplicate managed types have different visibilities.
1>LINK : fatal error LNK1255: link failed because of metadata errors
1>Done building project "corecli_v16.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 10 up-to-date, 0 skipped ==========
ILDasm Microsoft recommends trying to use ILDasm for this error but that doesn't work. When I tried using it from the command line as they described, it tells me I have to use it interactive mode. When I then try to use it in interactive mode and open up the .OBJ file in question, it wants an .EXE or DLL, not an .OBJ
MAP File I tried changing the linker settings to generate a MAP file but it never does. So I'm guessing thats not generated unless linking is successful.
Change Something, anything Sometimes the best way to figure out an obscure linker error is to make a change -- any change -- to force the linker to give you a different error so I tried changing the managed enum type to derive from System:UInt32 (a valid thing to do which I do with some of my other managed enums) just to see if I would get a different error. And I did get it to tell me that there were two different definitions of the enum in question, but not what they were. But aside from that, no extra information
But this still leads me to want to see the two definitions side-by-side. Not in code but as the linker sees them. How do I do that?
At the moment I'm interested in source code analysis and playing around with the built-in possibilities and other third party plguins.
The biggest problem for me, is to identify or filter for code analysis related warnings in the error list window of Visual Studio.
I think all warnings starting with "CA" are these types of errors. Anyway I'm still not sure and want to get this clarified, so that I have knowledge about this and not just a feeling/believe.
This problem brings me in general to the question: Is there a list of all error/warning "groups" and what they are related to? Is it possible that there are "custom" defined "groups"?
I think this is important since every warning will be pushed to the same window. Based on the task someone is working on, it can be pretty hard to identify relvant warnings/outputs (especially in huge projects).
So far my results or what I think is the meaning (list may be uncomplete):
CA - Source Code Analysis, based on this source
CS - C# compiler in general, based on assumption (I get these while compiling C#)
AD - ?? (I get these from "Roslyn Security Guard" when throwing exceptions while analysing code)
C - C/C++ compiler in general, based on assumption (I know this group of warnings from C/C++ projects)
SG - ?? (Maybe these are warnings coming from successfull analysed code with Roslyn Security Guard (SG = Security Guard?))
Yes SG comes from Roslyn Security Guard. It is a custom name chosen by developer of the analyzer. This is why there is no single list of warnings. Only groups of warnings produced by Microsoft are documented on Msdn. AD001 is shown when an analyzer itself throws an exception because of a bug in it.
When I open a generated solution+project file, I get the following warning for each platform I have in the project file:
path/to/project.vcxproj : warning : Platform '[some_platform, 0]' referenced in the project file 'project' cannot be found.
some_platform is a valid platform in the project, and building, browsing etc all work normally. There is no line number showing where the problem is.
My question is, what does '[some_platform, 0]' really mean?
Coming from Linux, I initially thought the quotes signify that I have [some_platform, 0] literally specified somewhere, which I don't. I don't see ,\s*0 used anywhere in the project file either. How do I decipher that message to be able to find out what it's complaining about?
This is a C++ project if that matters.
Edit: The only places , is even used are inside two messages and an SDK reference. So the [some_platform, 0] is definitely something constructed for the sake of warning, but what does the second part (0) mean?
Resolved: Why VS generates an output like that, I don't know, and who knows what the 0 means. However, it turned out that the platform name is something an SDK would register with VS (or something along those lines) and VS expects it case-sensitive. I had changed ORBIS and Durango to orbis and durango, causing the warning. Fixing the case makes the warning go away (the project was loading and building fine regardless).
I think you might have unmatched solution/project platform and build configurations, resulting in the rare case when visual studio defines or creates new ones: https://msdn.microsoft.com/en-us/library/kkz9kefa.aspx ending in the odd platform names '[some_platform, 0]', '[durango, 0]' and '[orbis, 0]' you have.
Now this is entirely my guess (since I could not find any documents to confirm it). But what that 0 actually means, is the reference to the default build configuration that project should use when you target those individual platforms. For instance, you usually have lines similar to this in the solution (.sln) file:{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
In the case above you would use build configuration 0 as the default build configuration when using msbuild solutionname.sln from the console. But since the entire platform was generated for that project, we of-course don't have a default build configuration either, so... lets generate. There is more details and examples of the default build-configuration in this post: Visual Studio solution file - what does the "Build.0" mean?
Now back to what might actually be your real problem. You mentioned SDK references, have you made sure they are pointing to the correct place and any environment variables is properly configured in visual studio? If not, the problem might be related to the warnings mentioned here:
Platform 'Android' referenced in the project file 'san-angeles' cannot be found. The warning message on that question sure looks similar to the warning you have, only you have those oddly generated platform names.
Hope this will help you solve the problem.
I'm using Visual Studio 11's profiler (sampling), and am having trouble getting the report to show me the code I need it to. The problem is that several of the assemblies won't load because they're "Native Images". The primary one I'm concerned about is "System.Core.ni.dll". Because that symbol isn't loading, when I go to view the report I can't see why my Expression is slow. Instead, it just bundles all of the samples related to Expressions into a line reading "System.Core.ni.dll".
If I look at the Output window, I see the following two lines:
Failed to load symbols for C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Core\713a8c0e41e664d349efcc0cec7f5e86\System.Core.ni.dll
Loaded symbols for C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll
Notice how the first symbol doesn't load?
What are my options? Can I stop native images from being used? Can I load the symbols for native images?
I had a similar problem on Windows 8 and found a post here that helped me solve the problem. Don't know if it will solve the OP's issue but it worked for me.
I suppress a few warnings, 1591 is the XML comments warning. It's not that I don't use the comments, there are some false positives.
Now to find the fact that XML comments warning is 1591 took a whole load of googling. Is there a list somewhere? Or a way to display the error number in Visual Studio itself?
Thanks
The Error List hides the error and warning numbers, but if you open the Output panel in Visual Studio (menu : Debug > Windows > Output) and set it to show output from Build, you can find the warning number somewhere in the wall of text.
You could also try building the project from the command line (using msbuild) which will output and highlight all error and warning numbers.
You can find a whole list of them here:
Compiler and Warning messages for C/C++
Compiler and Warning messages for C#
It honestly took me less than 5 seconds of Googling to find that, using the search terms "1591" and "visual studio". The top hit is right on the money: http://www.google.com/search?q=1591+visual+studio
So suffice it to say, this is how I usually find them.
But they're all documented on the page you land at with the above search results: C# Compiler Errors
Do note that the warning numbers are often different for different languages. In particular, C#, VB.NET, and C/C++ all use different compilers and therefore all emit different error codes.
C# Compiler Errors
C/C++ Build Errors
Also, it's worth noting that on VS 2008 and later, you can right-click over a warning in the "Error List" to display documentation related to that warning. This tells you the error level, the error number, and whatever other information you need.
I stumbled on this thread while trying to sort out how to find these in VS2015 with Beckhoff TwinCAT and found the Beckhoff-specific ones under Project->Properties, in the Compiler Warnings tab (as below in 1).
screencap of TwinCAT project properties' compiler warning list