@@ -11,17 +11,21 @@ internal sealed class ProxyOutputDevice : IOutputDevice
1111{
1212 private readonly ServerModePerCallOutputDevice ? _serverModeOutputDevice ;
1313
14- public ProxyOutputDevice ( IPlatformOutputDevice originalOutputDevice , ServerModePerCallOutputDevice ? serverModeOutputDevice )
14+ public ProxyOutputDevice ( IPlatformOutputDevice ? originalOutputDevice , ServerModePerCallOutputDevice ? serverModeOutputDevice )
1515 {
1616 OriginalOutputDevice = originalOutputDevice ;
1717 _serverModeOutputDevice = serverModeOutputDevice ;
1818 }
1919
20- internal IPlatformOutputDevice OriginalOutputDevice { get ; }
20+ internal IPlatformOutputDevice ? OriginalOutputDevice { get ; }
2121
2222 public async Task DisplayAsync ( IOutputDeviceDataProducer producer , IOutputDeviceData data , CancellationToken cancellationToken )
2323 {
24- await OriginalOutputDevice . DisplayAsync ( producer , data , cancellationToken ) . ConfigureAwait ( false ) ;
24+ if ( OriginalOutputDevice is not null )
25+ {
26+ await OriginalOutputDevice . DisplayAsync ( producer , data , cancellationToken ) . ConfigureAwait ( false ) ;
27+ }
28+
2529 if ( _serverModeOutputDevice is not null )
2630 {
2731 await _serverModeOutputDevice . DisplayAsync ( producer , data , cancellationToken ) . ConfigureAwait ( false ) ;
@@ -30,7 +34,11 @@ public async Task DisplayAsync(IOutputDeviceDataProducer producer, IOutputDevice
3034
3135 internal async Task DisplayBannerAsync ( string ? bannerMessage , CancellationToken cancellationToken )
3236 {
33- await OriginalOutputDevice . DisplayBannerAsync ( bannerMessage , cancellationToken ) . ConfigureAwait ( false ) ;
37+ if ( OriginalOutputDevice is not null )
38+ {
39+ await OriginalOutputDevice . DisplayBannerAsync ( bannerMessage , cancellationToken ) . ConfigureAwait ( false ) ;
40+ }
41+
3442 if ( _serverModeOutputDevice is not null )
3543 {
3644 await _serverModeOutputDevice . DisplayBannerAsync ( bannerMessage , cancellationToken ) . ConfigureAwait ( false ) ;
@@ -39,7 +47,11 @@ internal async Task DisplayBannerAsync(string? bannerMessage, CancellationToken
3947
4048 internal async Task DisplayBeforeSessionStartAsync ( CancellationToken cancellationToken )
4149 {
42- await OriginalOutputDevice . DisplayBeforeSessionStartAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
50+ if ( OriginalOutputDevice is not null )
51+ {
52+ await OriginalOutputDevice . DisplayBeforeSessionStartAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
53+ }
54+
4355 if ( _serverModeOutputDevice is not null )
4456 {
4557 await _serverModeOutputDevice . DisplayBeforeSessionStartAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
@@ -48,7 +60,11 @@ internal async Task DisplayBeforeSessionStartAsync(CancellationToken cancellatio
4860
4961 internal async Task DisplayAfterSessionEndRunAsync ( CancellationToken cancellationToken )
5062 {
51- await OriginalOutputDevice . DisplayAfterSessionEndRunAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
63+ if ( OriginalOutputDevice is not null )
64+ {
65+ await OriginalOutputDevice . DisplayAfterSessionEndRunAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
66+ }
67+
5268 if ( _serverModeOutputDevice is not null )
5369 {
5470 await _serverModeOutputDevice . DisplayAfterSessionEndRunAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
@@ -65,7 +81,11 @@ internal async Task InitializeAsync(ServerTestHost serverTestHost)
6581
6682 internal async Task HandleProcessRoleAsync ( TestProcessRole processRole , CancellationToken cancellationToken )
6783 {
68- await OriginalOutputDevice . HandleProcessRoleAsync ( processRole , cancellationToken ) . ConfigureAwait ( false ) ;
84+ if ( OriginalOutputDevice is not null )
85+ {
86+ await OriginalOutputDevice . HandleProcessRoleAsync ( processRole , cancellationToken ) . ConfigureAwait ( false ) ;
87+ }
88+
6989 if ( _serverModeOutputDevice is not null )
7090 {
7191 await _serverModeOutputDevice . HandleProcessRoleAsync ( processRole , cancellationToken ) . ConfigureAwait ( false ) ;
0 commit comments