just in time debugging errors как исправить
Disable the Just-In-Time Debugger
The Just-In-Time Debugger dialog box may open when an error occurs in a running app, and prevent the app from continuing.
The Just-In-Time Debugger gives you the option to launch Visual Studio to debug the error. You must have Visual Studio or another selected debugger installed to view detailed information about the error or try to debug it.
If you’re already a Visual Studio user and want to try to debug the error, see Debug using the Just-In-Time Debugger. If you can’t fix the error, or want to keep the Just-In-Time Debugger from opening, you can disable Just-In-Time debugging from Visual Studio.
If you had Visual Studio installed but no longer do, you may need to disable Just-In-Time debugging from the Windows registry.
If you don’t have Visual Studio installed, you can prevent Just-In-Time debugging by disabling script debugging or server-side debugging.
If you’re trying to run a web app, disable script debugging:
In Windows Control Panel > Network and Internet > Internet Options, select Disable script debugging (Internet Explorer) and Disable script debugging (other). The exact steps and settings depend on your version of Windows and your browser.
If you’re hosting an ASP.NET web app in IIS, disable server-side debugging:
After you disable Just-In-Time debugging, the app may be able to handle the error and run normally.
If the app still has an unhandled error, you may see an error message, or the app may crash or stop responding. The app won’t run normally until the error is fixed. You can try to contact the owner of the app and ask them to fix it.
Debug using the Just-In-Time Debugger in Visual Studio
Just-In-Time debugging can launch Visual Studio automatically when an app running outside Visual Studio errors or crashes. With Just-In-Time debugging, you can test apps outside of Visual Studio, and open Visual Studio to begin debugging when a problem occurs.
Just-In-Time debugging works for Windows desktop apps. It does not work for Universal Windows Apps, or for managed code that is hosted in a native application, such as Visualizers.
If you just want to stop the Just-In-Time Debugger dialog box from appearing, but don’t have Visual Studio installed, see Disable the Just-In-Time Debugger. If you once had Visual Studio installed, you may need to disable Just-In-Time debugging from the Windows registry.
Enable or disable Just-In-Time debugging in Visual Studio
To enable or disable Just-In-Time debugging, you must be running Visual Studio as an administrator. Enabling or disabling Just-In-Time debugging sets a registry key, and administrator privileges may be required to change that key. To open Visual Studio as an administrator, right-click the Visual Studio app and choose Run as administrator.
You can configure Just-In-Time debugging from the Visual Studio Tools > Options (or Debug > Options) dialog box.
To enable or disable Just-In-Time debugging:
On the Tools or Debug menu, select Options > Debugging > Just-In-Time.
In the Enable Just-In-Time debugging for these types of code box, select the types of code you want Just-In-Time debugging to debug: Managed, Native, and/or Script.
Select OK.
If you enable the Just-In-Time debugger, but it doesn’t open when an app crashes or errors, see Troubleshoot Just-In-Time debugging.
Disable Just-In-Time debugging from the Windows registry
Just-In-Time debugging may still be enabled even if Visual Studio is no longer installed on your computer. If Visual Studio is no longer installed, you can disable Just-In-Time debugging by editing the Windows registry.
To disable Just-In-Time debugging by editing the registry:
From the Windows Start menu, run the Registry Editor (regedit.exe).
In the Registry Editor window, locate and delete the following registry entries:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
If your computer is running a 64-bit operating system, also delete the following registry entries:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\DbgManagedDebugger
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
Make sure not to delete or change any other registry keys.
Close the Registry Editor window.
Enable Just-In-Time debugging of a Windows Form
By default, Windows Form apps have a top-level exception handler that lets the app keep running if it can recover. If a Windows Forms app throws an unhandled exception, it shows the following dialog:
To enable Just-In-Time debugging instead of standard Windows Form error handling, add these settings:
In a C++ Windows Form application, also set DebuggableAttribute to true in a .config file or in your code. If you compile with /Zi and without /Og, the compiler sets this attribute for you. If you want to debug a non-optimized release build, however, you must set DebuggableAttribute by adding the following line in your app’s AssemblyInfo.cpp file:
Use Just-In-Time debugging
This example walks you through Just-In-Time debugging when an app throws an error.
You must have Visual Studio installed to follow these steps. If you don’t have Visual Studio, you can download the free Visual Studio Community Edition.
Make sure Just-In-Time debugging is enabled in Tools > Options > Debugging > Just-In-Time.
For this example, you’ll make a C# console app in Visual Studio that throws a NullReferenceException.
In Visual Studio, create a C# console app (File > New > Project > Visual C# > Console Application) named ThrowsNullException. For more information about creating projects in Visual Studio, see Walkthrough: Create a simple application.
When the project opens in Visual Studio, open the Program.cs file. Replace the Main() method with the following code, which prints a line to the console and then throws a NullReferenceException:
To build the solution, choose either the Debug (default) or Release configuration, and then select Build > Rebuild Solution.
For more information about build configurations, see Understanding build configurations.
Open the built app ThrowsNullException.exe in your C# project folder (. \ThrowsNullException\ThrowsNullException\bin\Debug or . \ThrowsNullException\ThrowsNullException\bin\Release).
You should see the following command window:
The Choose Just-In-Time Debugger dialog opens.
Select OK.
The ThrowsNullException project opens in a new instance of Visual Studio, with execution stopped at the line that threw the exception:
You can start debugging at this point. If you were debugging a real app, you would need to find out why the code is throwing the exception.
If your app contains untrusted code, a security warning dialog box appears, enabling you to decide whether to proceed with debugging. Before you continue debugging, decide whether you trust the code. Did you write the code yourself? If the application is running on a remote machine, do you recognize the name of the process? If the app is running locally, consider the possibility of malicious code running on your computer. If you decide the code is trustworthy, select OK. Otherwise, select Cancel.
Troubleshoot Just-In-Time debugging
If Just-In-Time debugging doesn’t start when an app crashes, even though it is enabled in Visual Studio:
Windows Error Reporting could be taking over the error handling on your computer.
To fix this issue, use Registry Editor to add a DWORD Value of Disabled, with Value data of 1, to the following registry keys:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting
(For 64-bit machines): HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\Windows\Windows Error Reporting
A known Windows issue may be causing the Just-In-Time debugger to fail.
The fix is to add a DWORD Value of Auto, with Value data of 1, to the following registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug
(For 64-bit machines): HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug
You might see the following error messages during Just-In-Time debugging:
Unable to attach to the crashing process. The specified program is not a Windows or MS-DOS program.
The debugger tried to attach to a process running under another user.
To work around this problem, in Visual Studio, open Debug > Attach to Process (or press Ctrl + Alt + P), and find the process you want to debug in the Available Processes list. If you do not know the name of the process, find the Process ID in the Visual Studio Just-In-Time Debugger dialog. Select the process in the Available Processes list, and select Attach. Select No to dismiss the Just-In-Time debugger dialog.
Debugger could not be started because no user is logged on.
There is no user logged onto the console, so there is no user session to display the Just-In-Time debugging dialog.
To fix this problem, log onto the machine.
Class not registered.
The debugger tried to create a COM class that is not registered, probably due to an installation problem.
To fix this problem, use the Visual Studio Installer to reinstall or repair your Visual Studio installation.
Just-In-Time, Debugging, Options Dialog Box
To access the Just-In-Time page, go to the Tools menu and click Options. In the Options dialog box, expand the Debugging node and select Just-In-Time. This page allows you to enable Just-In-Time debugging for managed code, native code, and script. For more information, see Just-In-Time Debugging.
You can enable Just-In-Time debugging for these program types:
Just-In-Time debugging is a technique for debugging a program that is started outside Visual Studio. You can run a program created in Visual Studio outside of the Visual Studio environment. If you have enabled Just-in-time debugging, a crash will display a dialog box that asks if you want to debug.
Associated Warnings
When you visit this page of the Options dialog box, you might see a warning message like this:
Another debugger has registered itself as the Just-In-Time debugger. To repair, enable Just-In-Time debugging or run Visual Studio repair.
This message occurs if you have another debugger, possibly an older version of Visual Studio debugger, set as the Just-In-Time debugger.
Another message that you might see is as follows:
Just-In-Time debugging registration errors detected. To repair, enable Just-In-Time debugging or run Visual Studio repair.
If you see either of these warnings, Just-In-Time debugging with Visual Studio 2012 requires Administrator privileges until you have fixed the problem. If you try to enable just-as a non-administrator under these conditions, you will see the following error message:
Access is denied. Have an administrator enable Just-In-Time debugging, or repair your installation of Visual Studio.
Отключение JIT-отладки
Диалоговое окно JIT-отладки может открываться при возникновении ошибок в используемом приложении, препятствуя его работе.
JIT-отладчик позволяет быстро запустить Visual Studio для устранения ошибки. Для просмотра подробных сведений об ошибке или попытки отладки нужно установить среду Visual Studio или другой отладчик.
Если вы уже являетесь пользователем Visual Studio и после возникновения ошибки намерены выполнить отладку с помощью JIT-отладчика, перейдите к этой статье. Если вам не удается исправить ошибку или вы хотите запретить открытие JIT-отладчика, вы можете отключить JIT-отладку из Visual Studio.
Если набор средств Visual Studio был ранее установлен, но теперь его нет, придется нужно будет JIT-отладку через реестр Windows.
Если набор средств Visual Studio не установлен, для отключения JIT-отладки можно отключить отладку скриптов или отладку на стороне сервера.
Если вы пытаетесь запустить веб-приложение, отключите отладку скриптов.
Если вы размещаете веб-приложение ASP.NET в IIS, отключите отладку на стороне сервера, выполнив следующие действия:
Возможно, отключение JIT-отладки позволит приложению преодолеть ошибку и работать нормально.
Если необработанная ошибка в приложении сохранится, может отобразиться сообщение об ошибке либо приложение может перестать отвечать или аварийно завершить работу. В этом случае нормальная работа приложения будет невозможна без исправления ошибки. Попробуйте связаться с теми, кто отвечает за это приложение, и попросить исправить ошибку.
Страница «JIT-отладка», папка «Отладка», диалоговое окно «Параметры»
Чтобы получить доступ к странице JIT, перейдите к меню Сервис и щелкните пункт Параметры. В диалоговом окне Параметры разверните узел Отладка и выберите JIT. Эта страница позволяет включить JIT-отладку для управляемого кода, машинного кода и скриптов. Дополнительные сведения см. в разделе JIT-отладка.
JIT-отладку можно разрешить для программ следующих типов:
JIT-отладка — это технология отладки программы, запускаемой вне Visual Studio. Программу, созданную в Visual Studio, можно выполнять вне среды Visual Studio. Если включена JIT-отладка, сбой программы вызовет появление диалогового окна с вопросом о том, необходимо ли выполнить отладку.
Связанные предупреждения
При посещении этой страницы из диалогового окна Параметры можно увидеть предупреждающее сообщение, например следующего содержания:
В качестве JIT-отладчика был зарегистрирован другой отладчик. Для восстановления включите JIT-отладку или запустите средство восстановления Visual Studio.
Это сообщение возникает, если в качестве JIT-отладчика установлен другой отладчик, возможно, отладчик Visual Studio более старой версии.
Также возможно отображение следующего сообщения:
Обнаружены ошибки регистрации JIT-отладки. Для восстановления включите JIT-отладку или запустите средство восстановления Visual Studio.
Если отобразилось любое из этих предупреждений, для JIT-отладки с Visual Studio 2012 необходимы права администратора до тех пор, пока проблема не будет устранена. Если попытаться разрешить проблему, не имея прав администратора, возникает следующее сообщение об ошибке:
Отказано в доступе. Администратор должен включить JIT-отладку или восстановить установку Visual Studio.