Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit c25535c

Browse files
authored
Merge branch 'master' into fixes/1159-nre-repositorygroupdescription
2 parents bb7893a + bcdf132 commit c25535c

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/GitHub.App/Services/PullRequestService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ static string CreateTempFile(string fileName, string commitSha, string contents,
446446

447447
Directory.CreateDirectory(tempDir);
448448
File.WriteAllText(tempFile, contents, encoding);
449-
File.SetAttributes(tempFile, FileAttributes.ReadOnly);
450449
return tempFile;
451450
}
452451

src/GitHub.InlineReviews/Tags/InlineCommentTagger.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.IO;
43
using System.Linq;
54
using System.Reactive.Linq;
65
using System.Reactive.Subjects;
@@ -15,8 +14,7 @@
1514
using Microsoft.VisualStudio.Text.Tagging;
1615
using ReactiveUI;
1716
using System.Collections;
18-
using GitHub.Helpers;
19-
17+
using GitHub.VisualStudio;
2018
namespace GitHub.InlineReviews.Tags
2119
{
2220
/// <summary>
@@ -78,7 +76,7 @@ public InlineCommentTagger(
7876
signalRebuild = new Subject<ITextSnapshot>();
7977
signalRebuild.Throttle(TimeSpan.FromMilliseconds(500))
8078
.ObserveOn(RxApp.MainThreadScheduler)
81-
.Subscribe(x => Rebuild(x).Forget());
79+
.Subscribe(x => ForgetWithLogging(Rebuild(x)));
8280

8381
this.buffer.Changed += Buffer_Changed;
8482
}
@@ -137,8 +135,8 @@ public IEnumerable<ITagSpan<InlineCommentTag>> GetTags(NormalizedSnapshotSpanCol
137135
{
138136
var lineNumber = (leftHandSide ? line.OldLineNumber : line.NewLineNumber) - 1;
139137

140-
if (lineNumber >= startLine &&
141-
lineNumber <= endLine &&
138+
if (lineNumber >= startLine &&
139+
lineNumber <= endLine &&
142140
!linesWithComments[lineNumber - startLine]
143141
&& (!leftHandSide || line.Type == DiffChangeType.Delete))
144142
{
@@ -187,16 +185,21 @@ void Initialize()
187185

188186
if (session == null)
189187
{
190-
managerSubscription = sessionManager.WhenAnyValue(x => x.CurrentSession).Subscribe(SessionChanged);
188+
managerSubscription = sessionManager.WhenAnyValue(x => x.CurrentSession).Subscribe(x => ForgetWithLogging(SessionChanged(x)));
191189
}
192190
else
193191
{
194-
SessionChanged(session);
192+
ForgetWithLogging(SessionChanged(session));
195193
}
196194

197195
initialized = true;
198196
}
199197

198+
static void ForgetWithLogging(Task task)
199+
{
200+
task.Catch(e => VsOutputLogger.WriteLine("Exception caught while executing background task: {0}", e)).Forget();
201+
}
202+
200203
void NotifyTagsChanged()
201204
{
202205
var entireFile = new SnapshotSpan(buffer.CurrentSnapshot, 0, buffer.CurrentSnapshot.Length);
@@ -210,7 +213,7 @@ void NotifyTagsChanged(int lineNumber)
210213
TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(span));
211214
}
212215

213-
async void SessionChanged(IPullRequestSession session)
216+
async Task SessionChanged(IPullRequestSession session)
214217
{
215218
sessionSubscription?.Dispose();
216219
this.session = session;

0 commit comments

Comments
 (0)