// Today we ensure that all _ViewImports in the shared project exist on the guest because we don't currently track import documents // in a manner that would allow us to retrieve/monitor that data across the wire. Once the Razor sub-system is moved to use // DocumentSnapshots we'll be able to rely on that API to more properly manage files that impact parsing of Razor documents. private async Task EnsureViewImportsCopiedAsync(CollaborationSession sessionContext, CancellationToken cancellationToken) { var listDirectoryOptions = new ListDirectoryOptions() { Recursive = true, IncludePatterns = new[] { "*.cshtml" } }; var copyTasks = new List <Task>(); try { var roots = await sessionContext.ListRootsAsync(cancellationToken); if (cancellationToken.IsCancellationRequested) { return; } foreach (var root in roots) { var fileUris = await sessionContext.ListDirectoryAsync(root, listDirectoryOptions, cancellationToken); StartViewImportsCopy(fileUris, copyTasks, sessionContext, cancellationToken); } await Task.WhenAll(copyTasks); } catch (OperationCanceledException) { // Swallow task cancellations } }
// Today we ensure that all _ViewImports in the shared project exist on the guest because we don't currently track import documents // in a manner that would allow us to retrieve/monitor that data across the wire. Once the Razor sub-system is moved to use // DocumentSnapshots we'll be able to rely on that API to more properly manage files that impact parsing of Razor documents. private async Task EnsureViewImportsCopiedAsync(CollaborationSession sessionContext, CancellationToken cancellationToken) { var listDirectoryOptions = new ListDirectoryOptions() { Recursive = true, IncludePatterns = new[] { "*.cshtml" } }; var copyTasks = new List <Task>(); var roots = await sessionContext.ListRootsAsync(cancellationToken); foreach (var root in roots) { var fileUris = await sessionContext.ListDirectoryAsync(root, listDirectoryOptions, cancellationToken); StartViewImportsCopy(fileUris, copyTasks, sessionContext, cancellationToken); } await Task.WhenAll(copyTasks); }