@@ -63,7 +63,7 @@ public void ReportOnce(Action<Diagnostic> report, string product = Funding.Produ
6363 using var accessor = mmf . CreateViewAccessor ( ) ;
6464 if ( accessor . ReadByte ( 0 ) == 0 )
6565 {
66- accessor . Write ( 0 , 1 ) ;
66+ accessor . Write ( 0 , ( byte ) 1 ) ;
6767 report ( diagnostic ) ;
6868 Tracing . Trace ( $ "👈{ diagnostic . Severity . ToString ( ) . ToLowerInvariant ( ) } :{ Process . GetCurrentProcess ( ) . Id } :{ Process . GetCurrentProcess ( ) . ProcessName } :{ product } :{ diagnostic . Id } ") ;
6969 }
@@ -182,7 +182,7 @@ Diagnostic Push(Diagnostic diagnostic, string product = Funding.Product)
182182 mutex . WaitOne ( ) ;
183183 using var mmf = CreateOrOpenMemoryMappedFile ( id , 1 ) ;
184184 using var accessor = mmf . CreateViewAccessor ( ) ;
185- accessor . Write ( 0 , 0 ) ;
185+ accessor . Write ( 0 , ( byte ) 0 ) ;
186186 Tracing . Trace ( $ "👉{ diagnostic . Severity . ToString ( ) . ToLowerInvariant ( ) } :{ Process . GetCurrentProcess ( ) . Id } :{ Process . GetCurrentProcess ( ) . ProcessName } :{ product } :{ diagnostic . Id } ") ;
187187 }
188188
@@ -201,7 +201,7 @@ Diagnostic Push(Diagnostic diagnostic, string product = Funding.Product)
201201 }
202202 : null ;
203203
204- static MemoryMappedFile CreateOrOpenMemoryMappedFile ( string mapName , long capacity )
204+ static MemoryMappedFile CreateOrOpenMemoryMappedFile ( string mapName , int capacity )
205205 {
206206 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
207207 {
@@ -210,7 +210,11 @@ static MemoryMappedFile CreateOrOpenMemoryMappedFile(string mapName, long capaci
210210 else
211211 {
212212 // On Linux, use a file-based memory-mapped file
213- return MemoryMappedFile . CreateFromFile ( $ "/tmp/{ mapName } ", FileMode . OpenOrCreate ) ;
213+ string filePath = $ "/tmp/{ mapName } ";
214+ using ( var fs = new FileStream ( filePath , FileMode . OpenOrCreate , FileAccess . ReadWrite , FileShare . ReadWrite ) )
215+ fs . Write ( new byte [ capacity ] , 0 , capacity ) ;
216+
217+ return MemoryMappedFile . CreateFromFile ( filePath , FileMode . OpenOrCreate ) ;
214218 }
215219 }
216220
0 commit comments