"stack.cpp not found" prevents debug in VS 2013 express - visual-studio-debugging

I'm a rookie at C in general and VS 2013 also. I am trying to use some C code provided by a vendor in VS 2013 express. It compiles and runs without problem using the command line compiler but I would like to use the IDE.
I started a new project, C++ for console app, and I have pasted the code into the IDE and saved it as xyy.c so that it builds successfully. I thought it would be nice to have it in a GUI, so I duplicated the effort with a Win32 app project. It also builds.
The program's job is to connect to a PCI card that has Plx chip as an interface and program an FPGA. The Win32 program succeeds, even though I can't see any of the info printed by the program. The console program fails and I think it is because it fails to find the driver for the Plx chip. I thought I would get a clue by single stepping through the Win32 program to see which driver was supposed to be found.
However, after the first pass through a while loop, I get a pop up that says "Source Not Found" and "stack.cpp not found". Google wasn't any help to me.
I be grateful for any suggestions.

You might have "Enable .NET Framework source stepping" enabled (see http://msdn.microsoft.com/en-us/library/cc667410.aspx). So when you are at Stack... and trying to step into, it will actually try, but you don't have the sources for that. There is also a new experience for using the .NET framework reference source that was announced recently: http://blogs.msdn.com/b/dotnet/archive/2014/02/24/a-new-look-for-net-reference-source.aspx

I faced the same problem. I advise at the moment of receiving the information "stack.cpp not found" to look at the stack trace and check if there is something like this: "RTC".
If there is, you need to change the flag along the path (for example, set the Default or a more convenient configuration for you):
Project Properties -> C/C++ -> Code Generation -> Basic Runtime Checks
More details: https://learn.microsoft.com/en-us/cpp/build/reference/rtc-run-time-error-checks?view=msvc-160

Related

WPF application shows managed has exited with code -1073740771 (0xc000041d) in InitializeComponent call

When I launch my WPF application and when it goes to InitializeComponent function call of one user control, it silently quits and only leaves one message in the output window saying Managed (v4.0.30319)' has exited with code -1073740771 (0xc000041d). When I say "silently", I mean there is no exception is caught even if I wrap this InitializeComponent call with a try-catch block (that's how I normally find where the problem is)
Here is what I did: in this application project we need to use a reference Microsoft.Office.Interop.Owc.dll, with version number 10.0.4504.0. Since it is an interop library, when I added this reference in VS2012, it automatically sets the property Embedded Interop Types as true, which I assume means it will not keep an individual dll in the output folder but instead embed this library into the main output (at least this is how it seems in our other references, for example, Microsoft.Office.Interop.Outlook.dll). However, when I launch the project, it throws an XamlParseException saying:
"Could not load file or assembly 'Microsoft.Office.Interop.Owc, Version=10.0.4504.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system
cannot find the file specified.":"Microsoft.Office.Interop.Owc, Version=10.0.4504.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35""
It seems that the reference was not embedded(or the version is not currect. But I verified that the reference version is indeed 10.0.4504.0)
Next I copied this dll directly to the output folder bin\Debug\, to make sure that it can find this library. This time the exception is not thrown, but the whole application just silently quits as I described in the beginning. I tried to google the code -1073740771 (0xc000041d) but there is no article about it. I tried to set the Embedded Interop Types to true/false but the problem is the same.
UPDATE:
I'd like to add more description here. As mentioned above, the problematic library is OWC(Office Web Component)10. I followed this link to make OWC work with VB.NET desktop application: HOW TO: Handle Events for the Office Web Components in Visual Studio .NET. But this official article is so old so I had to make a lot of changes to compile the wrapper dll(mainly because of namespace mismatch). Then when I add the reference to the actual interop library Microsoft.Office.Interop.Owc, if I follow the default setting and let the Embedded Interop Types as True, at runtime it will complain (throw a XamlParseException) that the assembly cannot be loaded (see description above). What the hell? I thought make it as "embedded" would guarantee this library will be found. Then I copy this dll to the output folder, then I have this silently quit problem. But it might be worth mentioning that this time the output window shows the Microsoft.Office.Interop.Owc.dll is indeed loaded. Actually it is the last message before the managed has exited message. So it must still relate to this library.
All of this only happens with OWC10. There is actually a similar way to do that in OWC11(the latest, but unfortunately still pretty old version since it came with Office2003): HOW TO: Handle Events for the Office 2003 Web Components in Visual Studio .NET. But it actually works and the control is displayed on my application. It is because of some other reason that I wanted to try OWC10 instead of OWC11
When I launch my WPF application and when it goes to InitializeComponent function call of one user >control, it silently quits and only leaves one message in the output window saying Managed
(v4.0.30319)' has exited with code -1073740771 (0xc000041d). When I say "silently", I mean there is >no exception is caught even if I wrap this InitializeComponent call with a try-catch block (that's >how I normally find where the problem is)
Next I copied this dll directly to the output folder bin\Debug\, to make sure that it can find this >library. This time the exception is not thrown, but the whole application just silently quits as I >described in the beginning. I tried to google the code -1073740771 (0xc000041d) but there is no >article about it. I tried to set the Embedded Interop Types to true/false but the problem is the >same.
I had exactly the same thing happening to me today, "has exited with code -1073740771 (0xc000041d)." (This happened in both a VB and C# .NET WinForms application for me). I tried debugging and saw I never even got into the Form_Load code block.
I "solved" this in the end by running visual studio as an administrator (and then just opening & building and running the project via the menu).
This is a win8 security issue and it isn't well explained anywhere.
(I got distracted and just opened up a specific project straight out of my task bar/solution file which caused this to happen to me).
You've probably found this out by yourself by now, hope you didn't lose any hair over it :)
Just pointing this out for other people who might have this error occuring somewhere.
Also had this issue, the 'silent' exit with code -1073740771 (0xc000041d) on x64 platforms, on x86 platforms everything was OK.
Part of my application is unmanaged C++, another part is C#. It turned out that my C++ code was not completely ready for the x64 platform. The following change fixed the issue in my case:
// before
g_OrigWndProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC,
reinterpret_cast<LONG>(WindowProc)));
// fixed version
g_OrigWndProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(hWnd, GWLP_WNDPROC,
reinterpret_cast<LONG_PTR>(WindowProc)));
So, the generic recommendation is to verify that your code is completely ready for the x64 platform.

unknown build error "This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms"

So I enabled this group policy and the first time I tried to compile my solution I get this error. The funny thing is that I only use cryptographic function in one place but what I am seeing this on is all my Silverlight ResourceDictionary files and WPF userControl files. Everything else seems to compile fine.
Why am I seeing the error on only xaml files where I do nothing with encryption? I know I can disable the FIPS group policy but I do want to support it. Any idea why specific XAML files are throwing this error during compile?
I know I'm a bit late to the game but I recently came across this problem and also figured out a solution. For the reasons stated by #mdutra above, this is why it doesn't work but interestingly, Visual Studio 2010 and 2012 have two different "fixes".
A Microsoft Connect post (that no longer exists) stated:
Visual Studio 2012 now builds C# projects in a separate process that runs msbuild. The entry you added to devenv.exe.config (that worked for VS 2010) won't be seen by this process. You should add <enforceFIPSPolicy enabled="false"/> directly above the </runtime> tag in the msbuild.exe.config file; typically found at C:\Windows\Microsoft.Net\Framework\v4.0.30319\msbuild.exe.config.
I also added it to the C:\Windows\Microsoft.Net\Framework64\v4.0.30319\msbuild.exe.config file as well since I didn't know which MSBuild I was using.
After some research I found this answer which makes sense:
WPF and FIPS
Here are the contents of the link just in case it is removed:
The following is the reply I got from the WPF XAML team:
We didn’t fix it because this issue was discovered days (June 2, 2008) before the release.
I still have the BBPack I didn’t checkin. Here is the comment from the code.
// The Federal Information Processing Standard mandates that
// MD5 is obsolete and not safe for cryptographic checksums.
// We are using it to coordinating source files for debugging
// not authenticating so MD5 use is OK here.
// But, on a OS with the FIPS compliant switch ON, the managed
// MD5CryptoServiceProvider Ctor will throw. So we can't use it.
//
// Currently we use a PInvoke wrapper to the Native layer;
// which still works, even on a FIPS compliant machine. A Better
// fix would be to move to the approved SHA checksums, but that
// will require co-ordination with VS and the Debugger groups etc.
The MSI builder and a few other tools also threw on a FIPS=1 machine.
So even we if we fixed our part (in 3.5sp1), the customer’s end-to-end solution was still broken.
General FIPS info:
http://support.microsoft.com/kb/811833/en-us

debugging minifilters

I have been writing and debugging a minifilter on Windows 7 using the IFS Kit for some time now. it finally works, but as I require to add further functionality, I will spend some more days playing with it
what I'm worried about is debugging. until now I have simply built the driver, installed it on a virtual box and tested it by verifying dbg_print statements. I have been using this simple and error prone approach, as I could not find anything about how to debug minifilters more structured and programmatically.
are there any best practice methods to debug minifilters or filters? can visualDDK be used to add (remote) debugging functionality to visual studio for minifilters?
greetings,
curiosity
The Windows DDK includes a copy of windbg which you can use to connect to the VM over a named pipe with the appropriate configuration.
You can do one better by using VirtualKD to get an accelerated channel to talk to the kernel debugger embedded in Windows.
If you want to do debugging using the Visual Studio user interface, you should look at VisualDDK.
Both are powerful tools, but they require a little work to get set up the first time.
I tend to just use WinDBG because it is the easiest thing to set up on random QA machines etc.
But I have used those tools to iterate rapidly during initial development of a project.
Good luck.
Visual Studio does not support debugging in kernel mode. You can use kd or WinDbg, which are both part of the Debugger package included in Windows DDK. This will get you started with debugging:
Configure kernel debugger on VM and attach WinDbg. Instructions are here: http://ndis.com/ndis-debugging/virtual/vmwaresetup.htm.
Build your binaries in debug mode (or in release with full symbols).
Once WinDbg connected, fix up symbols, and source path. Make sure you added location of symbols of your new driver to the symbol path.
Now you can debug similar how you use VS for user mode apps.

The application failed to initialize properly (0xc0150002)

I have an image processing C program which uses OpenCV library. I was developing this with Visual Studio 2008 until this happened. So I moved the whole project to netbeans(6.9) and MinGW.
I have configured netbeans to use OpenCV libraries as guided in this blog.
But when I run the program it gives this error " The application failed to initialize properly (0xc0150002) "
I don't think this happens when trying to read any image files from the hard disk. It gives the error without even executing 1st line in the main method.
The only change I made to the code is this.
static __inline void release_mem( CvPoint2D64f*, CvPoint2D64f*, static struct feature** );
this gave me error : storage class specified for parameter 'type name'
so I changed the code to (Trial and error rather than any logic)
static __inline void release_mem( CvPoint2D64f*, CvPoint2D64f*, struct feature** );
It is a side-by-side configuration problem. Your program contains a manifest that states what DLL it needs from the SxS cache. And Windows can't find it. Start by looking at the Windows event log, it will tell you what DLL couldn't be found.
This is more typically a VS2008 problem, its DLL version of the CRT libraries are stored in the side-by-side cache. Like msvcrt90.dll. Maybe you didn't quite manage to get the code converted to your new build environment. Which is odd, embedding the manifest is an explicit build step. Do check that you don't have a .manifest file in your build directory.
This hoopla got retired in VS2010 btw. VS2010 Express could be your 3rd attempt.

Where's the source of mysqlclient.lib?

I have a C++ application which connects to a MySQL server.
It all works fine.
Currently it uses libmysql.dll.
At build time I link to libmysql.lib.
As far as I understand I can link to mysqlclient.lib instead and get rid of the dependency of libmysql.dll, i.e have the functionality embedded within my exe.
My question is: Where can I find the source to build mysqlclient.lib ?
When debugging the app when it's linked to mysqlclient.lib and stepping into mysql_library_init() for example the debugger (VC++ 2008) asks for the file "f:\build\mysql-5.0.67-winbuild\mysql-community-nt-5.0.67-build\libmysql\libmysql.c".
Note: libmysql.lib & mysqlclient.lib are included in the installation of MySQL.
IIRC, it's a part of the MySQL source code: http://dev.mysql.com/downloads/mysql/#downloads

Resources