I'm seeing a consistent crash in the analyzer with the following simple python code:
import email
def foo():
message = email.message_from_string("")
message.walk()
I'm running this on MacOS in VSCode with a Python 3.6 virtual env. I'm using the latest version of the vscode python extension (2018.12.1) which contains version 0.1.72 of the PLS.
The crash occurs in the method PythonAnalyzer.GetTypeFromObject (which is called by PythonAnalyzer.GetAnalysisValueFromObjects). The problem is that the walk member is of type ILazyMember, so when GetTypeFromObject is called, it is not able to determine its type, and it calls Debug.Fail which crashes the server. The crash occurs repeatedly as long as the file is open, and VSCode kills the service after five crashes.
I think the correct fix is to add the following lines to PythonAnalyzer.GetAnalysisValueFromObjects:
if (attr is ILazyMember lm) {
var member = lm.Get();
return GetAnalysisValueFromObjects(member);
}
This resolves the lazy member and recursively calls GetAnalysisValueFromObjects to determine its type. I've confirmed that with this fix, the crash no longer occurs, but I'm not familiar enough with the analysis engine and its internal objects to say for sure that this is the correct fix.