How to modify a Visual Studio project for having traces at the beginning and the ending of a function

Good afternoon,
I am working on a Visual Studio project (written in C) and in order to do some debugging, I would like to add traces.
This can be done in different ways:
int function_1();
{ #ifdef DEBUG
printf("function_1\n");
#endif... }
=>But as this implies that I need to copy the name of the functions everywhere, this is a lot of work.
A better approach:
int function_1();
{ #ifdef DEBUG
    printf("%s \n", __FUNCTION__);
  #endif... }
=> This is already better, but I still need to add those lines of code everywhere at the beginning (and the end) of my functions.
So I'm wondering, would it be possible to modify my Visual Studio project in such a way that some lines of code are added at the beginning and the ending of a function, and this for a whole file, project, solution? Does somebody know how to do this?
Thanks
Dominique

Probably you are looking for
/Gh (Enable _penter Hook Function)
https://msdn.microsoft.com/en-us/library/c63a9b7h.aspx
Besides there exists also
/GH (Enable _pexit Hook Function)
https://msdn.microsoft.com/en-us/library/xc11y76y.aspx
With kind regards

Similar Messages

  • How to deal with .csproj.user being created/modified by Visual Studio before the project is run?

    So, what is the problem?
    The problem is that Visual Studio considers .csproj.user a dependency of the project being run.
    Let us assume the following:
     - We have a freshly built solution containing a web application project `X` as the Start Up project. 
     - There are Silverlight applications served by the X web application.
     - There is no `X.csproj.user` file initially.
    Now consider the following flow of events:
     1. Open the solution in the Visual Studio
     2. Build.
     3. Run.
     4. A dialog is open to ask whether Silverlight debugging is to be enabled. Enable it.
     5. Stop the debugging session.
     6. Run again.
     7. Stop the debugging session.
     8. Run again.
    Assuming nothing is built at step 2 (because the solution is totally up to date), will there anything be built at steps 3 and 6?
    The answer is affirmative and here is why:
     - The X.csproj.user file is actually created by Visual Studio when the project is requested to run. What happens next is that the
    X.csproj.user file is considered a dependency of the project
    X by the Visual Studio. Being created just now the file is newer than the project binaries and so Visual Studio builds the project
    X. This explains why the project is built at step 3.
     - When we agree to enable Silverlight debugging Visual Studio records this agreement in the
    X.csproj.user file. So the file is modified again, after the project has started running. Restarting the debugging session is going to build the project
    X yet again, after all X.csproj.user is again newer than the binaries built a second ago. This explains why the project is built at step 6.
    Fortunately, nothing is built at step 8.
    Call me petty, but I want to avoid the builds at steps 3 and 6. The problem is that I am not allowed to check in the X.csproj.user file, because that is likely to create a mess with people accidentally checking in their private changes.
    On the other hand, I am unable to move its default content (along with the agreement to enable Silverlight debugging) into the project file
    X.csproj. Well, I can, but it is just being ignored.
    So, here is my question - is it possible to separate the content stored in a
    .csproj.user into two groups:
     - Permanent. These are the things I would love to have in the .csproj file. It will be checked in.
     - Temporary/Private. These are the things private to individual developers. Never checked in.
    Visual Studio already allows this separation for certain properties - see the
    Apply server settings to all users (store in project file) checkbox in the Web properties tab of a Web application project - http://olalalittlen.wordpress.com/2011/07/20/vs-tips-managing-server-settings-in-web-projects-for-multi-developer-scenarios/.
    However, it is insufficient.
    Any other ideas on how to prevent the aforementioned redundant builds are welcome too.

    Hi Mark,
    I think your issue is more about project itself. the saved information in the .csproj.user settings is about the project's information.
    So I suggest you post your issue to the related project forum.
    web forms:http://forums.asp.net/18.aspx/1?Web+Forms
    mvc:http://forums.asp.net/1146.aspx/1?MVC
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How do we use Script (batch file with msbuild/msbuild project) to build Cordova Project created with Visual Studio Tools for Apache Cordova?

    I use Visual Studio to create Cordova projects. I need to build Cordova projects using msbuild and buildbot via script for my project but I can find only information about how VS combine with Cordova CLI to build multi device hybrid application.

    Hi Samseth,
    Yes, correct, the only thing we can find on the MSDN is:
    Deploy and Run Your App
    And that's the reason why Visual Studio Tools for Apache Cordova existing.
    I think you may get more detail compile information from here:
    http://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Getting error when updating the JavaScript API for Office and manifest schema files in your Visual Studio project from version 1.0 to 1.1

    Hi,
    I`m getting error message like "None of the apps in your project can be activated in the target. The manifest file of one or more apps contain API sets or Office applications that are not supported by
    the target Office client. To debug those apps, update manifest files to exclude any unsupported API sets or Office applications, and then start the project again. Alternatively, you can debug your apps by using Office 365 as a target." when when
    updating the JavaScript API for Office and manifest schema files in your Visual Studio project from version 1.0 to 1.1 in manifest file though i have added host elements.
    any help in this regard is highly appreciated
    Thanks,
    Santosh Sutar  

    Hi Satosh Sutar,
    Based on the description, you got the error message when you update the apps from version 1.0 to 1.1.
    From the error message, it seems the menifest include some settings no allowed in the new version. Would you mind sharing more detail about how you update the project?
    And here is an article about updating apps for Office and menifest schema files in the project for your reference:
    How to: Update the JavaScript API for Office and manifest schema files in your Visual Studio project from version 1.0 to 1.1
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Known Issue: How to Install Visual Studio Tools for Universal Windows App Development (Windows 10 Insider Preview SDK and tools, April 2015 release)

    The Visual Studio Tools for Universal Windows App Development are not installed by default. If they are not installed, in the New Project dialog in Visual Studio 2015, you will see only a template “Download Windows Universal Tools”.
    For additional known issues with using Visual Studio 2015 RC, see
    https://support.microsoft.com/kb/3025133/

    Additional Installation Known issues:
    Visual Studio Tools for Universal Windows Apps Requires Windows 10 Build 10074 or later
    https://social.msdn.microsoft.com/Forums/en-US/de06c7c0-4248-4d68-bfcb-4b9a23fae1c0
    You cannot install the Visual Studio Tools for Universal Windows Apps on a pre-RC build of Visual Studio 2015
    https://social.msdn.microsoft.com/Forums/en-US/25d0b000-3ebb-4032-a786-99caf0390e9b
    Emulators for Windows Mobile 10.0.10069 : The installer failed. User cancelled installation. Error code: -2147023294
    https://social.msdn.microsoft.com/Forums/en-US/17bc9d5e-2ea7-4149-bb75-23997db8bd25/
    Setup warnings for Windows 10 SDK, Emulators for Windows Mobile, and Tools for Windows 10 Universal Apps
    https://social.msdn.microsoft.com/Forums/en-US/bfc4fcc0-cb48-4bb0-aab3-5797e31b08e0
    Fatal error when installing the Windows emulators: 2147023293
    https://social.msdn.microsoft.com/Forums/en-US/5485554c-e7e8-414e-a542-d1f7c0b6291c
    Do not install Visual Studio Express 2015 for Windows 10 on a Machine with Visual Studio Community, Professional, or Enterprise
    https://social.msdn.microsoft.com/Forums/en-US/94a29b17-baaf-4318-98ff-1cfc90a54bad/
    How to enable your Windows 10 device for development
    https://social.msdn.microsoft.com/Forums/en-US/6e34c9f0-5e3a-4b44-9aae-586ba94f8a28/

  • How can I double-click a file to open it in default app in my Visual Studio project without creating an installer?

    I have an app with code to open a file by double-clicking on it. The app in my Visual Studio project file should start automatically and then open the file automatically. I double-click on the file, then look for the app in my solution folder (I choose the
    .exe in the Debug folder). Am I choosing the correct .exe file?
    What I'm trying to do is test some code I wrote that will open the associated file type when I double click on it, as opposed to creating an installer, installing the app and then double-clicking on the file to see if it will open in the associated app automatically.

    Hi dudefromthebronx,
    Yes, I think you could doubt click the .exe file in your local machine.
    Of course, maybe you could get it in Bin\Debug or Bin\Release folder, it is related to the current project settings.
    But we would know some differences between them:
    http://stackoverflow.com/questions/11600162/difference-between-bin-debug-and-bin-release
    https://social.msdn.microsoft.com/Forums/en-US/0cde96e6-8dd8-4aa9-adcf-d7f45da13b66/debug-bin-release-folders?forum=vbide
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to hide different Viual Studio Projects from each other in one TFS Team Project with areas?

    Hi,
    at the moment I try to set up a "good" architecture for projects in TFS for our company.
    As often mentioned in TFS documentation we try to reduce the number of Team projects in our company which is organized in different business units (BUs).
    One great Team project shall contain a number of different Visual Studio projects, each one belonging to a separate BU.
    The grouping is as follows:
    Global Team project
           Business Unit A
                         Visual Studio Project A1
                         Visual Studio Project A2
           Business Unit B
                         Visual Studio Project B1
                         Visual Studio Project B2
    The programmers in business unit A must not see the Visual Studio projects of Business Unit B, but both groups (A an B) use the same process model (that is the reason why we try to group them in on team project).
    I try to put all the projects from both BUs in one TFS team project and separate them logically by an Area hierarchy like mentioned above.
    But areas only separate work items from each other, not Visual Studio projects.
    In Source Control Explorer I can only assign security issues on team project level (Global Team Project), not on business unit level.
    So every developer in BU A can see the Visual Studio projects in BU B...
    How can I model these dependencies?
    Regards and thanks
    Lothar

    Hi Lothar, 
    Thanks for your post.
    What’s the version of your TFS and VS?
    In Source Control Explorer, you can right-click on Business Unit A folder and select
    Advanced>>Security… to deny other group(s)’ access permissions on this folder. Then use the same way to set permissions on Business Unit B folder too.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Dynamic Image Displays Blank When Using In Visual Studio Project

    I am trying to simply display a dynamic image in a report. I am using Crystal Reports XI Release 2.
    I have two different environments: Local via Progress where reports are called using Crystal Viewer ActiveX, and over the web where reports are called from Open Laszlo and Visual Studio project.
    The image is set to a blank image as default, and Graphic Location Forumla loads the image from the database (site.logo_location + site.logo_filename) which results in an image http:
    www.vetinfo3.com\a.jpg.
    When I run the reports locally using the ActiveX control, it works just fine and displays the image.
    When I run over the web using OpenLaszlo, it displays a blank.
    Troubleshooting
    We are using Visual Studio 2005, which is bundled with an older version of Crystal that doesn't support dynamic images.
    To address this, I loaded Crystal XI Release 2, which updated the version in Visual Studio and enabled the Graphic Location formula field on the dev machine.
    I verified the Graphic Location field was set correctly.
    This caused a Version error, so we loaded cr_net_2005_mm_mlb_x86.zip on server and specified the Version in web.Config.
    No errors now, but when I build and publish the code, the image still displays as blank.
                From Fiddler
                   GET http://www.vetinfo3.com/mdsol1/CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_c5d6a923-293b-4f1e-8739-4e698f83b087.png
                   Creates C:\Documents and Settings\Curtis\Local Settings\Temporary Internet Files\Content.IE5\PWRUX2XW\CrystalImageHandler[1].png
                   Blank Image
    According to issues within Visual Studio, they say the fix to this is to add the <httpHandler> in web.Config, but it is already there; added when we add the viewer to the project:
    In web.Config I have some questions about this line:
        <httpHandlers>
          <add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        </httpHandlers>
    There are more service packs for Crystal XI Release 2:
    crXIr2sp2_net_server_install.zip
    crXIr2sp3_net_server_install.zip
    crXIr2sp4_net_server_install.zip
    I have not loaded these yet, but the readme files do not indicate they fix any dynamic image issues.
    I am out of ideas on this; does anyone have any ideas?

    What about if you take OpenLaszlo out of the picture? E.g.; use one of our samples from here;
    https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
    I'd recommend vbnet_web_simplepreviewreport
    Also, see [this|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0437ea8-97d2-2b10-2795-c202a76a5e80] article.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • Visual Studio Projects Not Showing FileVesion Leading Zeroes in File Properties

    I created a simple Visual Studio 2013 windows form application setting the AssemblyInfo.cs file as show below.
    // You can specify all the values or you can default the Build and Revision Numbers
    // by using the '*' as shown below:
    // [assembly: AssemblyVersion("1.0.*")]
    [assembly: AssemblyVersion("1.0.0.0227")]
    [assembly: AssemblyFileVersion("1.0.0.0227")]
    [assembly: AssemblyInformationalVersion("0.0.0.0227")]
    I built the application and went to the Windows File Explorer and brought up the file properties. What I see is that the product version showing the leading zeros, but the file version field does not show the leading zeros.
    It appears to be a bug either with Visual Studio or with Windows. Which one is it and is there a fix?

    Hi Sarah,
    We can't see the screenshot. Do you mean you use Windows Explorer to browse to the AssemblyInfo.cs file and check the property?
    If you change the product version or the file version from the AssemblyInfo.cs file, you need to firstly rebuild the assembly, then if you go to the debug/release folder, check the property of the assembly file, the Details tab will show you the corresponding
    changes of these properties. It's the assembly property but not the cs file property.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Libgit2 Error - Trying to checkout/clone a git repository with Visual Studio Tools for Git

    I'm trying to clone a branch from our git repository using Visual Studio Tools for Git. I'm doing the following:
    1. We have a local server that stores all our repositories and they are tracked using GIT+Stash
    2. I create a subbranch B1 from master in repository X using stash
    3. Stash will give me a URL in the form http://user@stash:7990/src/x/repository.git
    4. I go to Visual Studio (where I already installed Visual Studio Tools for Git) and follow the instructions to clone this branch to my local machine using the procedure as described in: Open and Clone a Git team project http://msdn.microsoft.com/en-us/library/hh850445.aspx#remote_3rd_party_connect_clone
    5. Visual studio shows the following error: An error occurred. Detailed message: An error was raised by libgit2. Category = Zlib (Error).
    Failed to inflate packfile
    What is libgit2? Is there anything I should change in my settings or paths? The only workaround I have found for this issue is to clone my branch through Source Tree (third party tool) and then open visual studio, then any other functionality will be fine
    (e.g. commits, push, sync, pull etc, all this I can do directly from Visual Studio)... but why can't I clone from Visual Studio?
    Notes:
    - We're not using TFS (i.e. we only use Git and I'm effectively trying to do the step found in this URL: http://msdn.microsoft.com/en-us/library/hh850445.aspx#remote_3rd_party_connect_clone)
    - We use Atlassian Stash (installed in our servers) to create the repositories and branches
    - I'm using Visual Studio 2012
    David

    Hi David,
    I am sorry that I can't reproduce your issue on my machine. I can't set the shared folder path (\\DEVELOPMENT) as local path, but I can set D:\folder which maps to the
    \\DEVELOPMENT path as the local path.
    Maybe you can submit one feedback on the Microsoft Connect site here above your issue:
    https://connect.microsoft.com/VisualStudio/feedback/CreateFeedbackForm.aspx?FeedbackFormConfigurationID=5303&FeedbackType=1
    Thanks.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I get Visual Studio 2010 to work with Crystal Reports?

    Hi,
    My office upgraded to Windows 7 and Visual Studio 2010 and now I can no longer write front end programs to Crystal Reports version 10.   Does anybody know if there is a a workaround?   Also, our version of Crystal Reports is 32 bit but the new desktop machine I have is 64 bit so there may be issues accessing the Crystal Reports DLLs which are now located in the Programs (x86) folder.
    It's all such a gigantic mess that I don't even know where to begin.   Visual Studio 2008 had Crystal Reports in it so it was real easy.
    Dave

    Try searching first before posting. CR for Visual Studio 2010 download is available on the OverView tab. It's a free install, we don't ship in VS now, it's still a plug in so you can't use VS 2010 Express version, MS doesn't support plugins in Express versions.
    Runtime files will be version 13 and should update your app without issues.
    Install VS 2010/2012/2013 first and then run the first link in the download page. Don't instlal just the runtime redist MSI, it will not integrate into VS.
    Also, set your Project for x86 and not any CPU and use the full .NET Framework and not the client version.
    Don

  • Add WSDL to Visual Studio Project  - Please help !

    Hi,
    In this address there is explained how to add wsdl class to our project (sheet 7)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0123164-9b30-2b10-a086-b8a7f973b3e1
    However, after "Add New Item" = SAP Connector Proxy,  Visual Studio is not asked me a question to select the u201CWSDL file from SAP IFRu201D. It operates this phase automatically. How can I do this manually?
    Briefly, how can I add my wsdl to visual studio project?
    Thanks,
    Johnson.
    Edited by: asdasd asda on Oct 9, 2008 12:41 PM
    Edited by: asdasd asda on Oct 9, 2008 12:42 PM

    Hi,
    did you find a solution to this?
    thanks

  • App.Xaml cannot be edited in design view(Visual Studio 2012 for Window Store).

     App.Xaml cannot be edited in design view(Visual Studio 2012 for Window Store).

    The
    Simple Application Walkthrough specifically instructs one to edit App.xaml (because it previously had you inject a defect by changing the name of the file StartupUri property points to). So that is the scenario, or one of them. I assume it is 'valid'
    to rename MainWindow.xaml to whatever you want it to be.
    So there should be some way in the IDE to fix this (short of changing the file name back to match StartupUri). What is it? 
    Like another person here, I just edited it with a text editor and reloaded it into VS. But...

  • Known Issue: Visual Studio Tools for Universal Windows Apps Requires Windows 10 Build 10074 or later (Windows 10 Insider Preview SDK and tools, April 2015 release)

    The Visual Studio Tools for Universal Windows Apps requires Windows 10 build 10074 or later. If you use an earlier build of Windows 10, you will see a notification in Visual Studio, the XAML designer will not be available, and you will get the following
    error when deploying apps to your local machine:
    Error : DEP0700 : Registration of the app failed. Deployment Register operation with target volume C: on Package
    <package ID> from: (<path_to_AppxManifest.xml>) failed with error 0x80073CFD. See
    http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues. (0x80073cfd)

    To work around this issue, either
    Use Windows 8.1 and deploy to the Windows Mobile Emulator
    Or, update your computer from an earlier Windows 10 flight to build 10074 or later. To do this,
    in Settings, open the Update & security section, and select the
    Windows Update tab. Then click Check for updates.

  • What version of Visual Studio should I use to build the samples in the CS5 plug-in SDK?

    I just downloaded the plug-in SDK for CS5.  I tried to build two of them in Visual Studio 2012.  VS2012 had to convert them for me.  The first one, 3DHeightField, failed abysmally, as it tried to redefine standard library keywords for no reason I'll ever understand.  It told me to enable warning CS4005 to find the illegal #define statement, but I don't know how to enable warnings, only how to disable them.
    The second I tried, Dissolve, failed because the compiler could not find afxres.h.
    What is the recommended way to build these projects?  And, if possible, could someone please point me to a sample filter plug-in project that will build in Visual Studio 2012 without having to be converted from some older version of Visual Studio?
    Thank you very much.
    RobR

    You can build these with Visual Studio 2012.  You just need to add the following preprocessor definition to your project.
    _ALLOW_KEYWORD_MACROS
    If adding it to your project doesn't work, you can also #define it in a source or header file that gets read early in the chain.

Maybe you are looking for

  • How can I remove synced photos off my iphone?

    Hi everyone I have updated the is04 software andI think I accidently requested all my pictures to be synced from my computer that I really dont want on there! I have about 3000 photos from my computer that are now on my iphone and I cannot go in and

  • Pen Tool Question...

    The Pen Tool is my favorite / go to selection tool. But can it do the following... I've made a path and converted it to a selection, then filled the area with a color or texture (on it's own layer). Now I find that I need to adjust (fine tune) the sh

  • Spry XML Data won't diplay - Help

    Here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=" http://www.w3.org/1999/xhtml" xmlns:spry=" http://ns.adobe.com/spry"> <head> <meta http-equiv="C

  • Pdf not opening in browser

    Just starting yesterday I am unable to open a PDF file with my browser (Chrome) . It wants me to download the file.  Until yesterday I was able to open any file and just view it with the browser with out downloading it as a file. What do I need to do

  • Virtual desktop template creation with UR1 - two issues

    There are two new issues affecting Virtual Desktop template creation with WMS 2012 with UR1. Issue #1: Some systems fail to create a new or customized virtual desktop template with UR1 applied. UR1 includes an updated MultiPoint Connector which is co