-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
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
Django templates intermittently throw failed key lookup exceptions #128
Comments
to repro, starting with the VS template for Django project: in layout.html, add this in the
add new item, copyright.html to the app/templates/app folder
Just my Code setting doesn't seem to make any difference. If you do the same with VS 2017/ptvsd 4.1.1, it does not break on that exception.
|
I tested with more versions, ptvsd 4.2.4 worked fine, ie it detects that it is a handled exception, and ptvsd 4.2.7+ (including debugpy) does not work as expected, it thinks it is unhandled. |
@fabioz almost certainly a pydevd bug regarding detection of handled/unhandled exception. |
Likely related to the fix for microsoft/ptvsd#694 and/or microsoft/ptvsd#1181 |
I'll investigate. |
Ok, so, showing the error that a variable is not defined happens that way by design... Now, related to the config, what happens is that in https://github.com/microsoft/debugpy/blob/master/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py#L727, if we are handling either caught/uncaught exceptions, if the Internally, there's actually a separate configuration for that... this is the 2nd time this comes up so, I think we should create a separate setting for this in the DAP too. We can either pass this option in the launch settings (something as Note that related to the fact that it is shown sometimes and not at others, I don't think there's much that we can do -- I know it should always break or never break, but it seems there is some kind of nondeterminism in p.s.: another option could be to never report |
If the template is still rendering correctly (sans the debugger), then the exception is effectively handled, isn't it? In which case we shouldn't be reporting it unless "Raised" is checked. |
Agreed. I'll do that change. |
This issue has been moved from a ticket on Developer Community.
When rendering a template in Visual Studio's Django test server, I intermittently observe the following error:
Message=Failed lookup for key [addRowButton] in [...]
The line this issue triggers on looks like this (lightly modified to hide structure):
{% include '.../components/gen_formset_table_form.html' with form=next formset=formset addRowButton=addRowButton addSortable=addSortable %}
It is true that addRowButton is undefined in this template. However, only on some runs is this exception thrown, and having references to undefined keys should not throw exceptions in Django templates.
Once this issue is observed on a given run of the test server, it will consistently reappear every time this template is rendered. And, vice-versa, if the issue does not appear, it never appears. Furthermore, simply pressing the "restart" button on the toolbar is likely to fix the issue.
I also observe on most runs of the test server the following, possibly related issue:
Original Comments
Visual Studio Feedback System on 2/20/2020, 11:15 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Visual Studio Feedback System on 3/26/2020, 06:52 PM:
I have detected that for the last 35 days, this issue didn't have much product team activity and a very small amount of new votes or comments. Based on this, its severity, and affected area, it’s my experience that this issue is very unlikely to be fixed.
Hugues Valois [MSFT] on 3/27/2020, 10:27 AM:
Thanks for the feedback.
We’ve just released Visual Studio 2019 16.5 and in which we’ve changed the “launch browser” action to wait until the console shows that web url, meaning it is ready to accept connections. What we had noticed in the past was that if it didn’t wait long enough, it could cause weird trouble in the connection leading to page errors.
There’s a small chance that it might help in your scenario, it would be worth trying when you get a chance to update VS.
If it doesn’t help, then I’d try to do those same things from command line rather than in VS and see if the issue still occurs.
thanks
Visual Studio Feedback System on 4/7/2020, 07:18 PM:
We will close this report in 14 days because we don’t have enough information to investigate further. To keep the problem open, please provide the requested details.
sirbayer on 4/12/2020, 00:43 PM:
Unfortunately, I can confirm that this hasn't resolved the issue; I'm still seeing the same exceptions after updating to 16.5.3.
I've never observed these issues when running from the Ubuntu on Windows terminal. In fact, the exceptions generated by VS do not appear in the VS terminal, either - they only seem to exist in the VS debug popups.
Hugues Valois on 4/16/2020, 01:49 PM:
Thanks sirbayer.
I’ve set up a repro for this and I can see that the behavior has changed between VS 2017 and VS 2019.
In VS 2019, even though I have unchecked all Python exceptions in the Exception Settings tool window, it still breaks on that exception. It doesn’t cause any problems with the application, I press F5 to continue and some code must be handling that exception since things work fine, no error in terminal.
However, the debugger should not be breaking when the exception is thrown, if I have all of them disabled in settings, and there is code that handles the exception. In VS 2017, it did not break under the same circumstances.
I was worried this was broken everywhere but fortunately this seem to only be an issue when debugging django templates.
I’ll transfer this over to our bug repo on github. Thank you for filing this.
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: