Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. Visual Studio - How to find which line in existing code requires elevated privileges

Visual Studio - How to find which line in existing code requires elevated privileges

Scheduled Pinned Locked Moved Visual Studio
csharpvisual-studiodebuggingbusinesshelp
4 Posts 3 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RossCoeH
    wrote on last edited by
    #1

    In the migration from windows 8 to windows 10 on a new computer I now have some previous programs that will not run in debug mode.

    The message given is: "This task requires the application to have elevated permissions." I understand the message, but I am wanting to have an application that does not require elevated permissions, so how do I find which line of code require it. Is there a tool I can use to find which lines of code or declarations create the elevated permission requirements. I am using Visual studio 2017 (VB). I can find plenty of web pages telling me how to run the code as administrator, but would appreciate help on how to locate the offending code.

    Madbiker

    M L 2 Replies Last reply
    0
    • R RossCoeH

      In the migration from windows 8 to windows 10 on a new computer I now have some previous programs that will not run in debug mode.

      The message given is: "This task requires the application to have elevated permissions." I understand the message, but I am wanting to have an application that does not require elevated permissions, so how do I find which line of code require it. Is there a tool I can use to find which lines of code or declarations create the elevated permission requirements. I am using Visual studio 2017 (VB). I can find plenty of web pages telling me how to run the code as administrator, but would appreciate help on how to locate the offending code.

      Madbiker

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      What sort of application is it, web, wpf, service, console? I wonder if a tool like resharper can do something like this. Other than that try/catch to identify the method I would think.

      Never underestimate the power of human stupidity RAH

      R 1 Reply Last reply
      0
      • R RossCoeH

        In the migration from windows 8 to windows 10 on a new computer I now have some previous programs that will not run in debug mode.

        The message given is: "This task requires the application to have elevated permissions." I understand the message, but I am wanting to have an application that does not require elevated permissions, so how do I find which line of code require it. Is there a tool I can use to find which lines of code or declarations create the elevated permission requirements. I am using Visual studio 2017 (VB). I can find plenty of web pages telling me how to run the code as administrator, but would appreciate help on how to locate the offending code.

        Madbiker

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        It is not in a line of code, it is in the application manifest. This may be a separate text file (with the .manifest extension), or a #pragma comment in one of the source files, or the settings in the Project Properties

        1 Reply Last reply
        0
        • M Mycroft Holmes

          What sort of application is it, web, wpf, service, console? I wonder if a tool like resharper can do something like this. Other than that try/catch to identify the method I would think.

          Never underestimate the power of human stupidity RAH

          R Offline
          R Offline
          RossCoeH
          wrote on last edited by
          #4

          It is a desktop app publishes as a oneclick application, but on my new computer I cannot even start debugging because the error message appears after build and before run. If I try and deploy the previous published version I get a similar error message requiring elevated privileges, but the log file is a bit more useful from previous publish of code and states that the item system.runtime.interopservices.COMexception requires elevation. Unfortunately that code is used in one area as part of the try..catch routine to give a user friendly warning message so reluctant to remove and there may be more issues on other lines of code. Obviously there is something different about deploy a published app in Windows 10 compared to windows 8 where it did run (after asking for user permission), but I do not know where to look or how to debug - any ideas. Madbiker

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups