Saved searches
Use saved searches to filter your results more quickly
Cancel Create saved search
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include errors detected based on information provided by the configurationProvider setting. (C/C++ 1696) #444
asdaqsamir opened this issue Mar 24, 2023 · 14 comments
include errors detected based on information provided by the configurationProvider setting. (C/C++ 1696) #444
asdaqsamir opened this issue Mar 24, 2023 · 14 comments
Comments
asdaqsamir commented Mar 24, 2023 •
I am able to build the makefile project fine using makefile extension but for some reason the includes are not being found by vscode.
My settings.json file looks like the following:
< "makefile.makeDirectory": "build", "makefile.makefilePath": "build/makefile_gcc_4.8.2_x86-64.mk", "makefile.makePath": "C:/ivy/keypad/lib/make/bin/make.exe", "makefile.configurations": [ < "name": "Default", "makeArgs": [ "-j", "15", "-O" ] >], "C_Cpp.default.configurationProvider": "ms-vscode.makefile-tools" >

See the image below for errors:
The text was updated successfully, but these errors were encountered:
sean-mcmanus transferred this issue from microsoft/vscode-cpptools Mar 24, 2023
sean-mcmanus removed their assignment Mar 24, 2023
Collaborator
andreeis commented Mar 24, 2023
@asdaqsamir , please set in your .vscode/settings.json:
«makefile.loggingLevel»: «Debug»,
«makefile.extensionOutputFolder»: «./MyOutputFolder» (or wherever you want us to create a folder or point to an existing folder where we can drop some files without causing you any inconvenience),
«makefile.extensionLog»: «extension.log»
Then reopen your project in VSCode, let the extension configure process finish (you can watch in the Makefile Tools output channel that logging stops and there is a «Configure finished» or similar message) then share with us these files from MyOutputFolder: dryrun.log and extension.log
Additionally, you can open the .c file in your screenshot, then run the command «C/C++ diagnostics» from the palette and share with us the text in the «C/C++ Diagnostics» output channel.
I see your «Default» configuration defined in settings.json and I assume you also selected it in the «C/C++» left panel UI (via the edit pen to the right of «Configuration» UI element).
andreeis added the more info needed label Mar 24, 2023
asdaqsamir commented Mar 24, 2023 •
My settings.json looks like this now:
< "makefile.loggingLevel": "Debug", "makefile.extensionOutputFolder": "build", "makefile.extensionLog": "extension.log", "makefile.makeDirectory": "build", "makefile.makefilePath": "build/makefile_gcc_4.8.2_x86-64.mk", "makefile.makePath": "C:/ivy/keypad/lib/make/bin/make.exe", "makefile.configurations": [ < "name": "Default", "makeArgs": [ "-j", "15", "-O" ] >], "C_Cpp.default.configurationProvider": "ms-vscode.makefile-tools" >
Following output is by running the «C/C++ Log diagnostics»
-------- Diagnostics - 3/24/2023, 2:35:25 PM Version: 1.14.5 Current Configuration: < "name": "Win32", "includePath": [ "c:\\ivy\\keypad\\lib\\lib_cml\\asset\\feature\\keypad\\v00/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "windowsSdkVersion": "10.0.19041.0", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "windows-msvc-x64", "intelliSenseModeIsExplicit": false, "cStandardIsExplicit": false, "cppStandardIsExplicit": false, "mergeConfigurations": false, "compilerPath": "cl.exe", "compilerPathIsExplicit": false, "configurationProvider": "ms-vscode.makefile-tools", "browse": < "limitSymbolsToIncludedHeaders": true, "path": [ "$/**" ] > > Custom browse configuration: < "browsePath": [] >Custom configurations: [ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c ] < "defines": [ "HAL_XLCAN", "NDEBUG", "MODULE_PLATFORM_AR", "A6MX" ], "includePath": [], "forcedInclude": [], "compilerPath": "c:\\ivy\\keypad\\lib\\lib_oel\\environment\\mingw\\bin\\x86_64-w64-mingw32-gcc.exe", "compilerArgs": [ "-B", "../../../../../..\\lib_oel\\environment\\mingw\\bin", "-g3", "-Wpacked", "-Wno-unknown-pragmas", "-Wall", "-fno-peephole", "-fshort-enums", "-funsigned-char", "-c", "-o", "do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_group.o", "../src/cml_keypad_indicator_group.c" ] >Translation Unit Mappings: [ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c ]: C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c Translation Unit Configurations: [ C:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\src\cml_keypad_indicator_group.c ]: Process ID: 20940 Memory Usage: 46 MB Compiler Path: C:\ivy\keypad\lib\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe Includes: C:\ivy\keypad\lib\lib_oel\environment\mingw\lib64\gcc\x86_64-w64-mingw32\4.8.3\include C:\ivy\keypad\lib\lib_oel\environment\mingw\lib64\gcc\x86_64-w64-mingw32\4.8.3\include-fixed C:\ivy\keypad\lib\lib_oel\environment\mingw\x86_64-w64-mingw32\include Defines: HAL_XLCAN NDEBUG MODULE_PLATFORM_AR A6MX Standard Version: c11 IntelliSense Mode: windows-gcc-x64 Other Flags: --gcc --gnu_version=40803 Total Memory Usage: 46 MB

I tried to edit the «Configuration» and I see the «Default» option. But when I select it, It doesn’t change the Configuration, it’s still showing «unset».
However, when I build the project, it builds successfully and shows me a notification saying that it’s building the current makefile configuration «Default».
Also I am not sure if it’s related, but when I start vscode, the makefile does not configure automatically and I do have to use the command palette and type «Makefile: Configure», so that I can see the C++ makefile UI on the left side and than I clean and build.
Contributor
sean-mcmanus commented Mar 24, 2023
The «includePath»: [], indicates the C/C++ extension isn’t being sent the includePath. One potential workaround would be to add «mergeConfigurations»: true and a manually configured «includePath»: [] and remove the defines from «defines»: [] in c_cpp_properties.json.
Collaborator
andreeis commented Mar 24, 2023
@asdaqsamir by reading dryrun.log I don’t see any -I arguments passed to the compiler. We have no way of knowing where you expect to include headers from. That’s why Makefile Tools passes [] include paths to CppTools.
Are the headers at the same location as the cml_keypad_indicator_group.c? Otherwise how is the build (which you say succeeds) knows to find them?
asdaqsamir commented Mar 25, 2023 •
@andreeis The project has been setup in a way that it depends on other makefiles (some people call them makelets), the most important of these makefiles are the includes.mk and lib.mk located in the build folder:
build: contains all the makefiles that are needed to build the makefile project
- makefile_gcc_4.8.2_x86-64.mk
- lib.mk
- includes.mk
Note that most of the makefile project is stitched together in $(VOB_ROOT)/lib_machine/tools/makefile/makefile_sim_win64.mk which is added at the end of makefile_gcc_4.8.2_x86-64.mk for the purpose of compiling within a common makefile architecture. In this makeflile, all the internal and external includes come together using the variables INC_PATHS_INT and INC_PATHS_EXT .

You can see all the files in the pic below:
Also not sure if it’s related but in the output tab of vscode, I see the following error message after successfully building the project.
Error: the task 'makefile: Makefile Tools Build Task' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
And the Terminal tab shows the following showing a successful build and copying the .a file:
* Executing task: & 'C:\ivy\keypad\lib\make\bin\make.exe' '-f' 'c:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\build\makefile_gcc_4.8.2_x86-64.mk' '-C' 'c:\ivy\keypad\lib\lib_cml\asset\feature\keypad\v00\build' '-j' '15' '-O' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' creating do_tgt_gcc_4.8.2_x86-64 if not exist do_tgt_gcc_4.8.2_x86-64 mkdir do_tgt_gcc_4.8.2_x86-64 make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' making do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt compiler include options file . make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' "C:/ivy/keypad/lib/make/bin/make" --no-print-directory -s -B -f ../../../../../../lib_machine/tools/makefile/helper_echo.mk goal=TGT_INC_ALL_OPTS TGT_INC_ALL_OPTS > do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' making do_tgt_gcc_4.8.2_x86-64/.objects object files list file . make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' "C:/ivy/keypad/lib/make/bin/make" --no-print-directory -s -B -f ../../../../../../lib_machine/tools/makefile/helper_echo.mk goal=OBJ_FILES OBJ_FILES > do_tgt_gcc_4.8.2_x86-64/.objects make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' ../src/cml_keypad_comm_mngr.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_comm_mngr.o ..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_comm_mngr.o ../src/cml_keypad_comm_mngr.c make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' ../src/cml_keypad_switch.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch.o ..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch.o ../src/cml_keypad_switch.c make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' ../src/cml_keypad_switch_proc.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch_proc.o ..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch_proc.o ../src/cml_keypad_switch_proc.c ../src/cml_keypad_switch_proc.c: In function 'cml_keypad_switch_proc_set_state': ../src/cml_keypad_switch_proc.c:232:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] nvm_block_write( wp->nv_handle, 0, 0, (uint8_t *)wp->nv_state, NVM_CURRENT_TASK_PRIORITY ); ^ ../src/cml_keypad_switch_proc.c: In function 'cml_keypad_switch_proc_init_nv': ../src/cml_keypad_switch_proc.c:298:13: warning: variable 'out_state' set but not used [-Wunused-but-set-variable] SData_t out_state = ; ^ ../src/cml_keypad_switch_proc.c: In function 'cml_keypad_switch_proc_update': ../src/cml_keypad_switch_proc.c:450:67: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] nvm_block_write( wp->nv_handle, 0, 0, (uint8_t *)wp->nv_state, NVM_CURRENT_TASK_PRIORITY ); ^ ../src/cml_keypad_switch_proc.c:497:63: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] nvm_block_write( wp->nv_handle, 0, 0, (uint8_t *)wp->nv_state, NVM_CURRENT_TASK_PRIORITY ); ^ make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' ../src/cml_keypad_switch_group.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch_group.o ..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_switch_group.o ../src/cml_keypad_switch_group.c make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' ../src/cml_keypad_illumination.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_illumination.o ..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_illumination.o ../src/cml_keypad_illumination.c make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' ../src/cml_keypad_indicator_proc.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_proc.o ..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_proc.o ../src/cml_keypad_indicator_proc.c make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' ../src/cml_keypad_indicator.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator.o ..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator.o ../src/cml_keypad_indicator.c make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' ../src/cml_keypad_indicator_group.c do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_group.o ..\..\..\..\..\..\lib_oel\environment\mingw\bin\x86_64-w64-mingw32-gcc.exe -B ../../../../../..\lib_oel\environment\mingw\bin -g3 -Wpacked -Wno-unknown-pragmas -Wall -fno-peephole -fshort-enums -funsigned-char -c -DHAL_XLCAN -DNDEBUG -DMODULE_PLATFORM_AR -DA6MX @do_tgt_gcc_4.8.2_x86-64/inc_all_opts.txt -o do_tgt_gcc_4.8.2_x86-64/cml_keypad_indicator_group.o ../src/cml_keypad_indicator_group.c make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' Making do_tgt_gcc_4.8.2_x86-64\libcml_keypad.a. ..\..\..\..\..\..\lib_oel\environment\mingw\bin\ar -r do_tgt_gcc_4.8.2_x86-64\libcml_keypad.a @do_tgt_gcc_4.8.2_x86-64/.objects ..\..\..\..\..\..\lib_oel\environment\mingw\bin\ar: creating do_tgt_gcc_4.8.2_x86-64\libcml_keypad.a make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' make: Entering directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build' Copying do_tgt_gcc_4.8.2_x86-64\libcml_keypad.a to ..\\..\\v00-a\\tgt_gcc_4.8.2_x86-64\libcml_keypad.a 1 file(s) copied. make: Leaving directory 'C:/ivy/keypad/lib/lib_cml/asset/feature/keypad/v00/build'
HPE Proliant Bios allert yellow message on start up
When you power up your new HPE Proliant server you may see this message in yellow.
Important information available or errors detected. Press F1 to continue. F2 for more information.
Push F2 and understand that the system is all healthy.
Why does the server give you this alert message?
Perhaps you have simply installed an additional power supply but have not plugged the cord into the mains.
Make code work in Visual Studio
Applies to:
Visual Studio
Visual Studio for Mac
Visual Studio Code
Visual Studio includes a powerful integrated set of project build and debugging tools. This article describes how Visual Studio can help you find problems in your code by using build output, code analysis, debugging tools, and unit tests.
You’ve figured out the editor and created some code. Now, you want to make sure the code works properly. In Visual Studio, as with most IDEs, there are two phases to making code work: building the code to catch and resolve project and compiler errors, and running the code to find run-time and dynamic errors.
Build your code
There are two basic types of build configuration: Debug and Release. The Debug configuration produces a slower, larger executable that allows for a richer interactive run-time debugging experience. The Debug executable should never be shipped. The Release configuration builds a faster, optimized executable that’s appropriate to ship (at least from the perspective of the compiler). The default build configuration is Debug.
The easiest way to build your project is to press F7, but you can also start the build by selecting Build > Build Solution from the main menu.

You can observe the build process in the Output window at the bottom of the Visual Studio UI (user interface). Errors, warnings, and build operations are displayed here. If you have errors (or if you have warnings above a configured level), your build fails. You can select the errors and warnings to go to the line where they occurred. Rebuild your project by either pressing F7 again (to recompile only the files with errors) or Ctrl+Alt+F7 (for a clean and complete rebuild).
There are two tabbed windows in the results window below the editor: the Output window, which contains the raw compiler output (including error messages); and the Error List window, which provides a sortable and filterable list of all errors and warnings.
When build succeeds, you see results like this in the Output window:

Review the Error List
Unless you’ve made no modifications to code you have previously and successfully compiled, you probably have an error. If you’re new to coding, you probably have lots of them. Errors are sometimes obvious, such as a simple syntax error or incorrect variable name, and sometimes they’re difficult to understand, with only a cryptic code to guide you. For a cleaner view of the issues, navigate to the bottom of the build Output window and select the Error List tab. This action takes you to a more organized view of the errors and warnings for your project, and gives you some extra options as well.

Select on the error line in the Error List window to jump to the line the error occurs in. (Or turn on line numbers by pressing Ctrl+Q, typing line numbers, and then choosing Turn line numbers on or off from the results. This action is the fastest way to get to the Options dialog where you can turn on line numbers.)


Press Ctrl+G to quickly jump to the line number where the error occurred.
Visual Studio identifies this error with a red «squiggle» underscore. Hover over it for more details. Make the fix and it goes away, although you might introduce a new error with the correction. (This action is called a «regression».)

Walk through the error list and address all the errors in your code.

Review errors in detail
Many errors might not make sense to you, phrased as they are in the terms of the compiler. In those cases, you might need additional information. From the Error List window, you can perform an automatic Bing search for more information on the error or warning. Right-click on the corresponding entry line and select Show Error Help from the context menu, or select the hyperlinked error code value in the Code column of the Error List.

Depending on your settings, either your web browser displays the search results for the error code and text, or a tab opens inside Visual Studio and shows the results of the Bing search. The results are from many different sources on the Internet, and you might not find all to be helpful.
Use code analysis
Code analyzers look for common code problems that can lead to run-time errors or problems in code management.
C# and Visual Basic code analysis
Visual Studio includes a built-in set of .NET Compiler Platform analyzers that examine C# and Visual Basic code as you type. You can install more analyzers as a Visual Studio extension, or as a NuGet package. If rule violations are found, they’re reported both in the Error List and in the code editor as a squiggle under the offending code.
C++ code analysis
To analyze C++ code, run static code analysis. Get in the habit of running it once you’ve cleaned up the obvious errors that prevent a successful build, and take some time to address the warnings it might produce. You can save yourself some headaches down the road, and you might learn a few code style techniques.
Press Alt+F11 (or select Analyze > Run Code Analysis on Solution from the top menu) to start static code analysis.

Any new or updated warnings appear in the Error List tab at the bottom of the IDE. Select a warning to jump to it in code.

Use Quick Actions to fix or refactor code
Quick Actions, available from the light bulb or screwdriver icon, let you refactor code inline. They’re an easy way to fix common warnings quickly and effectively in C#, C++, and Visual Basic code. To access them, right-click on a warning squiggle and select Quick Actions and refactorings. Or, when your cursor is on the line with the colored squiggle, press Ctrl+. or select the light bulb, error light bulb, or screwdriver icon in the margin. Visual Studio then shows you a list of possible fixes or refactorings you can apply to that line of code.

Quick Actions can be used wherever code analyzers determine there’s an opportunity to fix, refactor, or improve your code. Select on any line of code, right-click to open the context menu, and select Quick Actions and refactorings. If refactoring or improvement options are available, they’re displayed. Otherwise, the message No quick actions available here displays in the lower-left corner of the IDE.

With experience, you can quickly use the arrow keys and Ctrl+. to check for easy refactoring opportunities and clean up your code!
Run Code Cleanup
Visual Studio provides on-demand formatting of your C# code file, including code style preferences, through the Code Cleanup button at the bottom of the editor.

In addition to formatting your file for spaces, indents, and so on, Code Cleanup also applies a set of code style conventions that you define. Your preferences for each code style are read from the EditorConfig file, if you have one for the project, or from the code style settings in the Options dialog box.
Debug your running code
Now that you have successfully built your code and performed a little clean up, run it by pressing F5 or selecting Debug > Start Debugging. This action starts your app in a debug environment so you can observe its behavior in detail. The Visual Studio IDE changes while your app is running: the Output window is replaced by two new ones (in the default window configuration), the Autos/Locals/Watch tabbed window and the Call Stack/Breakpoints/Exception Settings/Output tabbed window. These windows have multiple tabs that allow you to inspect and evaluate your app’s variables, threads, call stacks, and other behaviors as it runs.

Stop your app by pressing Shift+F5 or by clicking the Stop button. Or, you can just close the app’s main window (or command-line dialog).
If your code ran perfectly and exactly as expected, congratulations! However, sometimes your code might stop responding, or crashes, or gives you some strange results. If so, you should try to find the source of those problems and fix the bugs.
Set simple breakpoints
Breakpoints are the most basic and essential feature of reliable debugging. A breakpoint indicates where Visual Studio should suspend your running code so you can take a look at the values of variables, or the behavior of memory, or whether a branch of code is getting run. You don’t need to rebuild a project after setting and removing breakpoints.
Set a breakpoint by clicking in the far margin of the line where you want the break to occur, or press F9 to set a breakpoint on the current line of code. When you run your code, it pauses (or break) before the instructions for this line of code are executed.

Common uses for breakpoints include:
- To narrow down the source of a crash or unresponsive program, scatter breakpoints throughout and around the code of the method call you think is causing the failure. As you run code in the debugger, remove and then reset the breakpoints closer together until you find the offending line of code. See the next section to learn how to run code in the debugger.
- When you introduce new code, set a breakpoint at the beginning of it, and run the code to make sure it’s behaving as expected.
- If you’ve implemented a complicated behavior, set breakpoints for the algorithmic code so you can inspect the values of the variables and data when the program breaks.
- If you’re writing C or C++ code, use breakpoints to stop the code so you can inspect address values (look for NULL) and reference counts when debugging for memory-related failures.
For more information about using breakpoints, see Use breakpoints in the Visual Studio debugger.
Inspect your code at run-time
When your running code hits a breakpoint and pauses, the line of code marked in yellow (the current statement) hasn’t executed yet. At this point, you might want to execute the current statement and then inspect the changed values. You can use several step commands to execute code in the debugger. If the marked code is a method call, you can step into it by pressing F11. You can also step over the line of code by pressing F10. For more commands and details on how to step through code, read Navigate through code by using the debugger.

In the preceding illustration, you can advance the debugger one statement by pressing either F10 or F11 (since there’s no method call here, both commands have the same result).
While the debugger is paused, you can inspect your variables and call stacks to determine what is going on. Are the values in the ranges you expect to see? Are calls being made in the right order?

Hover over a variable to see its current value and references. If you see a value you didn’t expect, you probably have a bug in the preceding or calling code. To learn more, see First look at the Visual Studio Debugger.
Additionally, Visual Studio displays the Diagnostic Tools window, where you can observe your app’s CPU and memory usage over time. Later in your app development, you can use these tools to look for unanticipated heavy CPU usage or memory allocation. Use it with the Watch window and breakpoints to determine what’s causing unexpected heavy usage or unreleased resources. For more information, see First look at profiling tools (C#, Visual Basic, C++, F#).
Run unit tests
Unit tests are your first line of defense against code bugs because, when done correctly, they test a single «unit» of code, typically a single function, and are easier to debug than your full program. Visual Studio installs the Microsoft unit testing frameworks for both managed and native code. Use a unit testing framework to create unit tests, run them, and report the results of these tests. Rerun unit tests when you make changes, to test that your code is still working correctly. With Visual Studio Enterprise edition, you can run tests automatically after every build.
To learn more about unit tests in Visual Studio and how they can help you create better quality code, read Unit test basics.
Related content
- First look at the debugger
- Generate, fix, and refactor code
- Explore the debugger documentation
Ошибка 404
В статье мы расскажем, что означает ошибка 404 на сайте. Также она может называться:
- 404 page not found,
- http error 404,
- error 404.
Ниже мы опишем, почему возникает ошибка 404, а также как ее отследить и исправить.
404 ошибка (http error 404) — что это значит?
Ошибка 404 page not found — это код ответа сервера. Что это значит?
Когда вы вводите адрес сайта, браузер запрашивает его стартовую страницу у сервера. Если сервер не может найти страницу, он сообщает об этом браузеру с помощью кода 404. Это сообщение отображается на экране пользователя в браузере.
Почему такое может произойти? Есть несколько возможных причин:
- Вы допустили ошибку при вводе адреса страницы или при открытии файла в браузере. Или браузеру не удалось найти IP-адрес сервера. Сервер не может найти и выдать данные потому, что вы дали ему неправильные «координаты». В таком случае вам достаточно просто исправить ошибку в URL-адресе, и вместо страницы с ошибкой 404 появятся искомые страница/файл.
- Данные (страница или файл) не размещены на сервере, или CMS неверно отвечает на запрос пользователя. В этом случае дело обстоит сложнее и быстро справиться с проблемой не получится. Чтобы устранить ошибку 404, определите, как создавался сайт, на котором обнаружена ошибка (на CMS или без использования CMS). От этого будет зависеть способ решения проблемы.
Мы рассмотрим, что делать с ошибкой 404 и как исправить.
Как убрать ошибку 404 на сайте, созданном на CMS (WordPress, Joomla, 1С-Битрикс и т.д.)
На сайтах, созданных с использованием CMS, встречаются различные страницы с ошибкой 404 (http status 404). В зависимости от типа страницы с ошибкой различаются причины возникновения и пути решения проблемы:
- Если вы видите на своем сайте стандартную ошибку 404 Рег.ру:

В большинстве случаев проблема связана с отсутствием конфигурационного файла .htaccess. Как избавиться от ошибки 404? Создайте в корневой папке сайта пустой текстовый файл с расширением .htaccess и добавьте в него стандартные директивы для используемой CMS. Стандартные директивы приведены в статье: Файлы .htaccess для популярных CMS.
Важно: в панели управления cPanel файл .htaccess по умолчанию скрыт (т.е. он существует, но не виден). Следуйте инструкции, чтобы включить отображение файла. Затем сверьте его содержимое со стандартным.
Если файл .htaccess существует и его содержимое корректно, а ошибка 404 not found сохраняется, обратитесь в техническую поддержку.
- Если вы видите иную страницу ошибки, которую отдает CMS сайта. Например:

Ошибка на WordPress

Пользовательская ошибка 404 not found
Возможно, страница не создана или не опубликована на этапе размещения сайта в админке CMS. Также ошибка может быть связана с формированием «человекопонятных» ЧПУ-ссылок с помощью SEO-плагинов. Чтобы избавиться от проблемы, необходимо обратиться к веб-разработчикам сайта или на тематические форумы, на которых представлена необходимая техническая информация (ошибка http 404).
Как быстро устранить ошибку 404 на сайте, созданном без использования CMS
На сайтах, созданных без использования CMS, код ошибки 404 отображается следующим образом:

Что означает это сообщение? Запрашиваемые страница/файл отсутствуют или размещены в неправильной папке (не в корневой папке сайта).
Что делать? Откройте корневую папку сайта в панели управления хостингом и проверьте, находятся ли в ней файлы вашего сайта.
- Если искомые файлы отсутствуют, следуйте инструкции: Как загрузить файл в корневой каталог сайта? После размещения файлов в корневой папке ошибка 404 должна исчезнуть.
- Если файлы существуют и находятся в корневой папке, обратитесь в техническую поддержку.
Как находить и мониторить код ошибки 404?
Если вы владелец сайта, вы можете найти страницы с ошибкой с помощью специальных сервисов. Самые популярные сервисы:
- Яндекс.Вебмастер,
- Google Search Console,
- Screaming Frog.
Ниже мы описали, как работать с каждым из них.
Яндекс.Вебмастер
- Авторизуйтесь в Яндекс.Вебмастер.
- Перейдите в раздел Индексирование — Страницы в поиске:

HTTP status 404 — что это
- Выберите Исключенные страницы:

- Добавьте фильтр, при котором отобразятся результаты с ошибкой «404 page not found»:

Google Search Console
- Авторизуйтесь в Google Search Console.
- Разверните блок Индекс и выберите Покрытие:

404 ошибка: что это
- Используйте фильтр, который покажет код ошибки 404. Для этого перейдите в раздел Сведения и кликните Отправленный URL не найден (ошибка 404):

Ошибка 404: что значит и как исправить
Screaming Frog
- Загрузите программу с официального сайта.
- Установите её на компьютер.
- Откройте программу, введите ссылку на сайт и нажмите Start:

- Перейдите во вкладку Response Code. Из выпадающего списка выберите фильтр Client Error (4xx):

Открывается только главная страница сайта, на внутренних страницах ошибка 404 или 500
Рассмотрим, что значит и как исправить ошибку отображения внутренних страниц сайта (error 404 или 500). Причиной проблемы является отсутствие файла .htaccess (либо он пустой, либо в нем не хватает необходимых директив для работы CMS). Решить проблему может замена текущего файла .htaccess стандартным для данной CMS.
На хостинге Linux
Если у вас ispmanager, проверьте, не включены ли Автоподдомены. Если они включены, отключите их, проверьте актуальность проблемы.
В остальных случаях для устранения внутренней ошибки 404 или 500, перейдите в корневую папку сайта: Как узнать корневую папку сайта
Создайте файл .htaccess (или замените его) со следующим содержимым:
Файл .htaccess для Joomla
## # @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $ # @package Joomla # @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. # @license http://www.gnu.org/copyleft/gpl.html GNU/GPL # Joomla! is Free Software ## ##################################################### # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE # # The line just below this section: 'Options +FollowSymLinks' may cause problems # with some server configurations. It is required for use of mod_rewrite, but may already # be set by your server administrator in a way that dissallows changing it in # your .htaccess file. If using it causes your server to error out, comment it out (add # to # beginning of line), reload your site in your browser and test your sef url's. If they work, # it has been set by your server administrator and you do not need it set here. # ##################################################### ## Can be commented out if causes errors, see notes above. Options +FollowSymLinks # # mod_rewrite in use RewriteEngine On ########## Begin - Rewrite rules to block out some common exploits ## If you experience problems on your site block out the operations listed below ## This attempts to block the most common type of exploit `attempts` to Joomla! # ## Deny access to extension xml files (uncomment out to activate) # #Order allow,deny #Deny from all #Satisfy all # ## End of deny access to extension xml files RewriteCond % mosConfig_[a-zA-Z_](=|\%3D) [OR] # Block out any script trying to base64_encode crap to send via URL RewriteCond % base64_encode.*\(.*\) [OR] # Block out any script that includes a tag in URL RewriteCond % (\<|%3C).*script.*(\>|%3E) [NC,OR] # Block out any script trying to set a PHP GLOBALS variable via URL RewriteCond % GLOBALS(=|\[|\%[0-9A-Z]) [OR] # Block out any script trying to modify a _REQUEST variable via URL RewriteCond % _REQUEST(=|\[|\%[0-9A-Z]) # Send all blocked request to homepage with 403 Forbidden error! RewriteRule ^(.*)$ index.php [F,L] # ########## End - Rewrite rules to block out some common exploits # Uncomment following line if your webserver's URL # is not directly related to physical file paths. # Update Your Joomla! Directory (just / for root) # RewriteBase / ########## Begin - Joomla! core SEF Section # RewriteCond % !-f RewriteCond % !-d RewriteCond % !^/index.php RewriteCond % (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] RewriteRule (.*) index.php RewriteRule .* - [E=HTTP_AUTHORIZATION:%,L] # ########## End - Joomla! core SEF Section
Файл .htaccess для WordPress
# BEGIN WordPress RewriteEngine On RewriteBase / RewriteCond % !-f RewriteCond % !-d RewriteRule . /index.php [L] # END WordPress
Файл .htaccess для HostCMS
Options +FollowSymlinks AddDefaultCharset Off php_flag magic_quotes_gpc off php_flag magic_quotes_runtime off php_flag register_globals off php_flag magic_quotes_gpc off php_flag magic_quotes_runtime off php_flag register_globals off DirectoryIndex index.php index.htm index.html RewriteEngine On RewriteBase / RewriteCond % !-f RewriteCond % !-d RewriteRule ^(.*)$ /index.php
Файл .htaccess для Bitrix
Options -Indexes ErrorDocument 404 /404.php php_flag allow_call_time_pass_reference 1 php_flag session.use_trans_sid off #php_value display_errors 1 #php_value mbstring.func_overload 2 #php_value mbstring.internal_encoding UTF-8 Options +FollowSymLinks RewriteEngine On RewriteCond % !-f RewriteCond % !-l RewriteCond % !-d RewriteCond % !/bitrix/urlrewrite.php$ RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L] RewriteRule .* - [E=REMOTE_USER:%] DirectoryIndex index.php index.html ExpiresActive on ExpiresByType image/jpeg "access plus 3 day" ExpiresByType image/gif "access plus 3 day"
Файл .htaccess для ModX
# MODx supports Friendly URLs via this .htaccess file. You must serve web # pages via Apache with mod_rewrite to use this functionality, and you must # change the file name from ht.access to .htaccess. # # Make sure RewriteBase points to the directory where you installed MODx. # E.g., "/modx" if your installation is in a "modx" subdirectory. # # You may choose to make your URLs non-case-sensitive by adding a NC directive # to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC] RewriteEngine On RewriteBase / # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin #RewriteCond % . #RewriteCond % !^example-domain-please-change\.com [NC] #RewriteRule (.*) http://example-domain-please-change.com/$1 [R=301,L] # # or for the opposite domain.com -> www.domain.com use the following # DO NOT USE BOTH # #RewriteCond % . #RewriteCond % !^www\.example-domain-please-change\.com [NC] #RewriteRule (.*) http://www.example-domain-please-change.com/$1 [R=301,L] # # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent # https://www.domain.com when your cert only allows https://secure.domain.com #RewriteCond % !^443 #RewriteRule (.*) https://example-domain-please-change.com.com/$1 [R=301,L] # # The Friendly URLs part RewriteCond % !-f RewriteCond % !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] # # Make sure .htc files are served with the proper MIME type, which is critical # for XP SP2. Un-comment if your host allows htaccess MIME type overrides. #AddType text/x-component .htc # # If your server is not already configured as such, the following directive # should be uncommented in order to set PHP's register_globals option to OFF. # This closes a major security hole that is abused by most XSS (cross-site # scripting) attacks. For more information: http://php.net/register_globals # # To verify that this option has been set to OFF, open the Manager and choose # Reports -> System Info and then click the phpinfo() link. Do a Find on Page # for "register_globals". The Local Value should be OFF. If the Master Value # is OFF then you do not need this directive here. # # IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS : # # Your server does not allow PHP directives to be set via .htaccess. In that # case you must make this change in your php.ini file instead. If you are # using a commercial web host, contact the administrators for assistance in # doing this. Not all servers allow local php.ini files, and they should # include all PHP configurations (not just this one), or you will effectively # reset everything to PHP defaults. Consult www.php.net for more detailed # information about setting PHP directives. # #php_flag register_globals Off # # For servers that support output compression, you should pick up a bit of # speed by un-commenting the following lines. # #php_flag zlib.output_compression On #php_value zlib.output_compression_level 5 # # The following directives stop screen flicker in IE on CSS rollovers. If # needed, un-comment the following rules. When they're in place, you may have # to do a force-refresh in order to see changes in your designs. # #ExpiresActive On #ExpiresByType image/gif A2592000 #ExpiresByType image/jpeg A2592000 #ExpiresByType image/png A2592000 #BrowserMatch "MSIE" brokenvary=1 #BrowserMatch "Mozilla/4.[0-9]" brokenvary=1 #BrowserMatch "Opera" !brokenvary #SetEnvIf brokenvary 1 force-no-vary
Файл .htaccess для Drupal
# # Apache/PHP/Drupal settings: # # Protect files and directories from prying eyes. Order allow,deny # Don't show directory listings for URLs which map to a directory. Options -Indexes # Follow symbolic links in this directory. Options +FollowSymLinks # Make Drupal handle any 404 errors. ErrorDocument 404 /index.php # Force simple error message for requests for non-existent favicon.ico. # There is no end quote below, for compatibility with Apache 1.3. ErrorDocument 404 "The requested file favicon.ico was not found. # Set the default handler. DirectoryIndex index.php index.html index.htm # Override PHP settings that cannot be changed at runtime. See # sites/default/default.settings.php and drupal_initialize_variables() in # includes/bootstrap.inc for settings that can be changed at runtime. # PHP 5, Apache 1 and 2. php_flag magic_quotes_gpc off php_flag magic_quotes_sybase off php_flag register_globals off php_flag session.auto_start off php_value mbstring.http_input pass php_value mbstring.http_output pass php_flag mbstring.encoding_translation off # Requires mod_expires to be enabled. # Enable expirations. ExpiresActive On # Cache all files for 2 weeks after access (A). ExpiresDefault A1209600 # Do not allow PHP scripts to be cached unless they explicitly send cache # headers themselves. Otherwise all scripts would have to overwrite the # headers set by mod_expires if they want another caching behavior. This may # fail if an error occurs early in the bootstrap process, and it may cause # problems if a non-Drupal PHP file is installed in a subdirectory. ExpiresActive Off # Various rewrite rules. RewriteEngine on # Block access to "hidden" directories whose names begin with a period. This # includes directories used by version control systems such as Subversion or # Git to store control files. Files whose names begin with a period, as well # as the control files used by CVS, are protected by the FilesMatch directive # above. # # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is # not possible to block access to entire directories from .htaccess, because # is not allowed here. # # If you do not have mod_rewrite installed, you should remove these # directories from your webroot or otherwise protect them from being # downloaded. RewriteRule "(^|/)\." - [F] # If your site can be accessed both with and without the 'www.' prefix, you # can use one of the following settings to redirect users to your preferred # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option: # # To redirect all users to access the site WITH the 'www.' prefix, # (http://example.com/. will be redirected to http://www.example.com/. ) # uncomment the following: # RewriteCond % !^www\. [NC] # RewriteRule ^ http://www.%% [L,R=301] # # To redirect all users to access the site WITHOUT the 'www.' prefix, # (http://www.example.com/. will be redirected to http://example.com/. ) # uncomment the following: # RewriteCond % ^www\.(.+)$ [NC] # RewriteRule ^ http://%1% [L,R=301] # Modify the RewriteBase if you are using Drupal in a subdirectory or in a # VirtualDocumentRoot and the rewrite rules are not working properly. # For example if your site is at http://example.com/drupal uncomment and # modify the following line: # RewriteBase /drupal # # If your site is running in a VirtualDocumentRoot at http://example.com/, # uncomment the following line: # RewriteBase / # Pass all requests not referring directly to files in the filesystem to # index.php. Clean URLs are handled in drupal_environment_initialize(). RewriteCond % !-f RewriteCond % !-d RewriteCond % !=/favicon.ico RewriteRule ^ index.php [L] # Rules to correctly serve gzip compressed CSS and JS files. # Requires both mod_rewrite and mod_headers to be enabled. # Serve gzip compressed CSS files if they exist and the client accepts gzip. RewriteCond % gzip RewriteCond %\.gz -s RewriteRule ^(.*)\.css $1\.css\.gz [QSA] # Serve gzip compressed JS files if they exist and the client accepts gzip. RewriteCond % gzip RewriteCond %\.gz -s RewriteRule ^(.*)\.js $1\.js\.gz [QSA] # Serve correct content types, and prevent mod_deflate double gzip. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1] RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1] # Serve correct encoding type. Header append Content-Encoding gzip # Force proxies to cache gzipped & non-gzipped css/js files separately. Header append Vary Accept-Encoding