Skip to content

Commit b330ff9

Browse files
Backflow from https://github.com/dotnet/dotnet / 8b29a16 build 277635
[[ commit created by automation ]]
1 parent 4bd6464 commit b330ff9

File tree

97 files changed

+317
-740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+317
-740
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/MarkupCompiler.cs

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -550,28 +550,18 @@ private void _Compile(string relativeSourceFile, bool pass2)
550550
xamlParser.BamlRecordWriter == null &&
551551
IsBamlNeeded)
552552
{
553-
if (_pendingLocalFiles == null)
554-
{
555-
_pendingLocalFiles = new ArrayList(10);
556-
}
553+
_pendingLocalFiles ??= new ArrayList(10);
557554

558555
_pendingLocalFiles.Add(relativeSourceFile);
559556
}
560557

561-
if (_codeContexts != null)
562-
{
563-
_codeContexts.Clear();
564-
_codeContexts = null;
565-
}
558+
_codeContexts?.Clear();
559+
_codeContexts = null;
566560

567561

568562
SourceFileInfo?.CloseStream();
569-
570-
if (bamlStream != null)
571-
{
572-
bamlStream.Close();
573-
bamlStream = null;
574-
}
563+
bamlStream?.Close();
564+
bamlStream = null;
575565
}
576566
}
577567

@@ -597,11 +587,8 @@ private void GenerateSource()
597587
_ccRoot.CodeNS.Types.Add(_ccRoot.CodeClass);
598588
}
599589

600-
if (_usingNS != null)
601-
{
602-
_usingNS.Clear();
603-
_usingNS = null;
604-
}
590+
_usingNS?.Clear();
591+
_usingNS = null;
605592

606593
if (IsCompilingEntryPointClass)
607594
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/ParserExtension.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -676,12 +676,8 @@ public override void WriteEndAttributes(XamlEndAttributesNode xamlEndAttributesN
676676
_compiler.ConnectNameAndEvents(_name, _events, _connectionId);
677677

678678
_name = null;
679-
680-
if (_events != null)
681-
{
682-
_events.Clear();
683-
_events = null;
684-
}
679+
_events?.Clear();
680+
_events = null;
685681
}
686682
else
687683
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Shared/SourceFileInfo.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,8 @@ internal Stream Stream
138138
//
139139
internal void CloseStream()
140140
{
141-
if (_stream != null)
142-
{
143-
_stream.Close();
144-
_stream = null;
145-
}
141+
_stream?.Close();
142+
_stream = null;
146143
}
147144

148145
#endregion

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/ResourcesGenerator.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,8 @@ protected override void Dispose(bool disposing)
103103
{
104104
if (disposing)
105105
{
106-
if (null != _sourceStream)
107-
{
108-
_sourceStream.Dispose();
109-
_sourceStream = null;
110-
}
106+
_sourceStream?.Dispose();
107+
_sourceStream = null;
111108
}
112109
}
113110
}
@@ -153,7 +150,7 @@ public override bool Execute()
153150
return false;
154151
}
155152

156-
if (OutputResourcesFile != null && OutputResourcesFile.Length > 1)
153+
if (OutputResourcesFile?.Length > 1)
157154
{
158155
// Every task should generate only one .resources.
159156
Log.LogErrorWithCodeFromResources(nameof(SR.MoreResourcesFiles));

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/NetStream.cs

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -402,16 +402,10 @@ protected override void Dispose(bool disposing)
402402
FreeByteRangeDownloader();
403403

404404
// Free Event Handles - should not throw
405-
if (_readEventHandles[(int)ReadEvent.FullDownloadReadEvent] != null)
406-
{
407-
_readEventHandles[(int)ReadEvent.FullDownloadReadEvent].Close();
408-
_readEventHandles[(int)ReadEvent.FullDownloadReadEvent] = null;
409-
}
410-
if (_readEventHandles[(int)ReadEvent.ByteRangeReadEvent] != null)
411-
{
412-
_readEventHandles[(int)ReadEvent.ByteRangeReadEvent].Close();
413-
_readEventHandles[(int)ReadEvent.ByteRangeReadEvent] = null;
414-
}
405+
_readEventHandles[(int)ReadEvent.FullDownloadReadEvent]?.Close();
406+
_readEventHandles[(int)ReadEvent.FullDownloadReadEvent] = null;
407+
_readEventHandles[(int)ReadEvent.ByteRangeReadEvent]?.Close();
408+
_readEventHandles[(int)ReadEvent.ByteRangeReadEvent] = null;
415409

416410
// Free Full Download
417411
_responseStream?.Close();
@@ -1167,11 +1161,8 @@ private void ReleaseFullDownloadResources()
11671161
FreeByteRangeDownloader();
11681162

11691163
// release the full download read event as it is no longer needed
1170-
if (_readEventHandles[(int)ReadEvent.FullDownloadReadEvent] != null)
1171-
{
1172-
_readEventHandles[(int)ReadEvent.FullDownloadReadEvent].Close();
1173-
_readEventHandles[(int)ReadEvent.FullDownloadReadEvent] = null;
1174-
}
1164+
_readEventHandles[(int)ReadEvent.FullDownloadReadEvent]?.Close();
1165+
_readEventHandles[(int)ReadEvent.FullDownloadReadEvent] = null;
11751166
}
11761167
finally
11771168
{
@@ -1196,12 +1187,8 @@ private void FreeByteRangeDownloader()
11961187
try
11971188
{
11981189
((IDisposable)_byteRangeDownloader).Dispose();
1199-
1200-
if (_readEventHandles[(int)ReadEvent.ByteRangeReadEvent] != null)
1201-
{
1202-
_readEventHandles[(int)ReadEvent.ByteRangeReadEvent].Close();
1203-
_readEventHandles[(int)ReadEvent.ByteRangeReadEvent] = null;
1204-
}
1190+
_readEventHandles[(int)ReadEvent.ByteRangeReadEvent]?.Close();
1191+
_readEventHandles[(int)ReadEvent.ByteRangeReadEvent] = null;
12051192
}
12061193
finally
12071194
{

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/GestureRecognizer.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,9 @@ public void Dispose()
227227
// Since the constructor might create a null _nativeRecognizer,
228228
// here we have to make sure we do have some thing to dispose.
229229
// Otherwise just no-op.
230-
if ( _nativeRecognizer != null )
231-
{
232-
_nativeRecognizer.Dispose();
233-
_nativeRecognizer = null;
234-
}
235-
230+
_nativeRecognizer?.Dispose();
231+
_nativeRecognizer = null;
232+
236233
_disposed = true;
237234
}
238235

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/InputGestureCollection.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,9 @@ public void Clear()
356356
{
357357
throw new NotSupportedException(SR.ReadOnlyInputGesturesCollection);
358358
}
359-
360-
if (_innerGestureList != null)
361-
{
362-
_innerGestureList.Clear();
363-
_innerGestureList = null;
364-
}
359+
360+
_innerGestureList?.Clear();
361+
_innerGestureList = null;
365362
}
366363

367364
/// <summary>

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Cursor.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,8 @@ public void Dispose()
116116

117117
private void Dispose(bool disposing)
118118
{
119-
if ( _cursorHandle != null )
120-
{
121-
_cursorHandle.Dispose();
122-
_cursorHandle = null;
123-
}
119+
_cursorHandle?.Dispose();
120+
_cursorHandle = null;
124121
}
125122

126123
/// <summary>

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/InputLanguageSource.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,8 @@ public void Initialize()
8282
/// </summary>
8383
public void Uninitialize()
8484
{
85-
if (_ipp != null)
86-
{
87-
_ipp.Uninitialize();
88-
_ipp = null;
89-
}
85+
_ipp?.Uninitialize();
86+
_ipp = null;
9087
}
9188

9289
#endregion Public Methods

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/InputManager.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -625,12 +625,8 @@ internal static void CancelSynchronizedInput()
625625
_listeningElement = null;
626626
_synchronizedInputEvents = null;
627627
_pairedSynchronizedInputEvents = null;
628-
629-
if (_synchronizedInputAsyncClearOperation != null)
630-
{
631-
_synchronizedInputAsyncClearOperation.Abort();
632-
_synchronizedInputAsyncClearOperation = null;
633-
}
628+
_synchronizedInputAsyncClearOperation?.Abort();
629+
_synchronizedInputAsyncClearOperation = null;
634630
}
635631
}
636632

0 commit comments

Comments
 (0)