@@ -18,8 +18,9 @@ protected enum ProfilingStateEnum { psStopped, psProfiling, psPaused }
1818 protected System . Collections . Concurrent . ConcurrentQueue < ProfilerEvent > m_events ;
1919 protected readonly System . Collections . Generic . List < PerfColumn > m_columns ;
2020 protected readonly YukonLexer m_Lex ;
21-
22-
21+ protected readonly bool m_isWindows ;
22+
23+
2324 protected readonly ProfilerEvent m_EventStarted = new ProfilerEvent ( ) ;
2425 protected readonly ProfilerEvent m_EventStopped = new ProfilerEvent ( ) ;
2526 protected readonly ProfilerEvent m_EventPaused = new ProfilerEvent ( ) ;
@@ -54,11 +55,11 @@ public SqlServerProfiler(string server, string database
5455 this . m_password = password ;
5556 this . m_integrated_security = string . IsNullOrWhiteSpace ( username ) ;
5657
57- bool isWindows = System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform (
58+ this . m_isWindows = System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform (
5859 System . Runtime . InteropServices . OSPlatform . Windows
5960 ) ;
6061
61- if ( this . m_integrated_security && ! isWindows )
62+ if ( this . m_integrated_security && ! this . m_isWindows )
6263 {
6364 throw new System . ArgumentException ( $ "Username is NULL or empty. Cannot use integrated-security on non-windows platform.") ;
6465 }
@@ -399,8 +400,12 @@ protected void NewEventArrived(ProfilerEvent evt, bool last)
399400 string caption = GetEventCaption ( evt ) ;
400401 System . Console . Write ( caption ) ;
401402 System . Console . Write ( new string ( ' ' , System . Console . BufferWidth - System . Console . CursorLeft ) ) ;
402- System . Console . Write ( System . Environment . NewLine ) ;
403+
404+ if ( ! this . m_isWindows )
405+ System . Console . Write ( System . Environment . NewLine ) ;
403406
407+
408+
404409 string td = evt . GetFormattedData ( ProfilerEventColumns . TextData , null ) ;
405410 // System.Console.WriteLine(td);
406411
@@ -417,9 +422,12 @@ protected void NewEventArrived(ProfilerEvent evt, bool last)
417422 } ;
418423
419424
420- // var lex = new YukonLexer(); lex.SyntaxHighlight(cw, td);
421- this . m_Lex . SyntaxHighlight ( cw , td ) ;
422- // rich.Rtf = this.m_Lex.SyntaxHighlight(rb, td);
425+ if ( ! string . IsNullOrEmpty ( td ) )
426+ {
427+ // var lex = new YukonLexer(); lex.SyntaxHighlight(cw, td);
428+ this . m_Lex . SyntaxHighlight ( cw , td ) ;
429+ // rich.Rtf = this.m_Lex.SyntaxHighlight(rb, td);
430+ }
423431
424432 // for(int i = 0; i < 65; ++i) // 65 is size of array
425433 // System.Console.WriteLine(evt.GetFormattedData(i, null));
0 commit comments