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.Dismiss alert
After making some first steps with Avalonia, I've added Avalonia-based project to entire project solution and got Avalonia XAML editor unusable - every attempt to open axaml file ended in VS crashing. I was able to resolve this with two changes:
Adding
if(result.Contains(reference))return;
in Services/SolutionService.cs in FlattenProjectReferences function as shown below to avoid project reference loop and stack overflow exception while unrolling references.
privatestaticvoidFlattenProjectReferences(Dictionary<Project,ProjectInfo>projects,Projectreference,HashSet<Project>result){if(result.Contains(reference))return;
result.Add(reference);if(projects.TryGetValue(reference,outvar info)){foreach(var child in info.ProjectReferences){
FlattenProjectReferences(projects, child, result);}}}
Wrapping part of GetProjectsAsync function in the same file with try/catch because C++ projects were causing exceptions due to some unresolvable properties.
First foreach loop modified:
foreach(var project in FlattenProjects(_dte.Solution)){if(project.Object is VSProject vsProject){try{varprojectInfo=new ProjectInfo
{IsStartupProject= startupProjects?.Contains(project.UniqueName)??false,Name= project.Name,Project=project,ProjectReferences= GetProjectReferences(vsProject),References= GetReferences(vsProject),};
result.Add(project, projectInfo);// If the project is a .csproj and it has no references then we assume its// references are not yet loaded. We might want to handle e.g. F# and VB// projects here too.if(IsCsproj(projectInfo)&& projectInfo.References.Count ==0){
uninitialized.Add(vsProject, projectInfo);}}catch(Exceptionexc){;}}}
I do not know this extension code deeply so I am not sure if this brakes something but those changes made Avalonia usable in huge solution with multiple projects and mixed technologies.
If this is already fixed in some branch please close this issue. Before posting I've checked code from master but it is also crashing.
The text was updated successfully, but these errors were encountered:
I bet it crashes when it access Reference.SourceProject property. I was struggling with this a lot today. Didn't know why it does not happen in any other solution but you got it, i have C project in my solution. I solved it by wrapping the access to Reference.SourceProject.
Have you checked the second problem with unrolling projects structure? There are sometimes reference loops that ends with stack overflow. I'm not sure if this is related to the main issue or not.
Have you checked the second problem with unrolling projects structure? There are sometimes reference loops that ends with stack overflow. I'm not sure if this is related to the main issue or not.
After making some first steps with Avalonia, I've added Avalonia-based project to entire project solution and got Avalonia XAML editor unusable - every attempt to open axaml file ended in VS crashing. I was able to resolve this with two changes:
in
Services/SolutionService.cs
inFlattenProjectReferences
function as shown below to avoid project reference loop and stack overflow exception while unrolling references.GetProjectsAsync
function in the same file with try/catch because C++ projects were causing exceptions due to some unresolvable properties.First foreach loop modified:
I do not know this extension code deeply so I am not sure if this brakes something but those changes made Avalonia usable in huge solution with multiple projects and mixed technologies.
If this is already fixed in some branch please close this issue. Before posting I've checked code from master but it is also crashing.
The text was updated successfully, but these errors were encountered: