private async Task AnalyzeReferenceAsync(VsProjectAnalyzer interp) {
            if (interp != null) {
                _failedToAnalyze = false;

                var resp = await interp.AddReferenceAsync(new ProjectAssemblyReference(AssemblyName, Url));
                if (resp == null) {
                    _failedToAnalyze = true;
                }
            }
        }
Esempio n. 2
0
        internal async Task AddAnalyzedAssembly(VsProjectAnalyzer interp) {
            if (interp != null) {
                var asmName = AssemblyName;
                string outFile;
                try {
                    outFile = ReferencedProjectOutputPath;
                } catch (COMException) {
                    _failedToAnalyze = true;
                    return;
                }
                _failedToAnalyze = false;
                _curReference = null;

                if (!string.IsNullOrEmpty(asmName)) {
                    _asmName = new AssemblyName(asmName);
                    _curReference = new ProjectAssemblyReference(_asmName, ReferencedProjectOutputPath);
                } else if (File.Exists(outFile)) {
                    _asmName = null;
                    _curReference = new ProjectReference(outFile, ProjectReferenceKind.ExtensionModule);
                } else {
                    if (ReferencedProjectObject == null ||
                        !Utilities.GuidEquals(PythonConstants.ProjectFactoryGuid, ReferencedProjectObject.Kind)) {
                        // Only failed if the reference isn't to another Python
                        // project.
                        _failedToAnalyze = true;
                    }
                }

                if (_curReference != null) {
                    try {
                        await interp.AddReferenceAsync(_curReference);
                    } catch (Exception) {
                        _failedToAnalyze = true;
                    }
                }
            }
        }
Esempio n. 3
0
        internal void AnalyzeReference(VsProjectAnalyzer interp)
        {
            if (interp == null) {
                _failedToAnalyze = true;
                return;
            }

            _failedToAnalyze = false;
            var task = interp.AddReferenceAsync(new ProjectReference(_filename, ProjectReferenceKind.ExtensionModule));

            // check if we get an exception, and if so mark ourselves as a dangling reference.
            task.ContinueWith(new TaskFailureHandler(TaskScheduler.FromCurrentSynchronizationContext(), this).HandleAddRefFailure);
        }