• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DemoBytom / DemoEngine / 13123725757

03 Feb 2025 10:03PM UTC coverage: 10.779% (-0.8%) from 11.563%
13123725757

push

coveralls.net

DemoBytom
Fixing winforms deadlocks

an await operation must return to the thread it was spawned on, because due to using winforms the main thread must be SDA.
But because the windows messages are handled by a loop, and that loop had a async operation - the message to switch back to main thread deadlocks

227 of 2106 relevant lines covered (10.78%)

24786.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Demo.Engine.Core/Platform/ContentFileProvider.cs
1
// Copyright © Michał Dembski and contributors.
2
// Distributed under MIT license. See LICENSE file in the root for more information.
3

4
using Demo.Engine.Core.Interfaces.Platform;
5
using Microsoft.Extensions.Hosting;
6

7
namespace Demo.Engine.Core.Platform;
8

9
internal sealed class ContentFileProvider(
×
10
    IHostEnvironment environment)
×
11
    : IContentFileProvider
12
{
13
    private readonly IHostEnvironment _environment = environment;
×
14

15
    public string GetAbsolutePath(string path)
16
        => Path.Combine(
×
17
            _environment.ContentRootPath,
×
18
            path);
×
19

20
    public Stream CreateFile(
21
        string fileSubPath)
22
    {
23
        var path = Path.Combine(
×
24
            _environment.ContentRootPath,
×
25
            fileSubPath);
×
26
        var dirPath = Path.GetDirectoryName(path);
×
27

28
        ArgumentException.ThrowIfNullOrEmpty(dirPath);
×
29

30
        if (!Directory.Exists(dirPath))
×
31
        {
32
            _ = Directory.CreateDirectory(dirPath);
×
33
        }
34

35
        return new FileStream(
×
36
                path: path,
×
37
                mode: FileMode.Create,
×
38
                access: FileAccess.Write);
×
39
    }
40

41
    public Stream OpenFile(
42
        string fileSubPath)
43
        => new FileStream(
×
44
            path: Path.Combine(
×
45
                _environment.ContentRootPath,
×
46
                fileSubPath),
×
47
            mode: FileMode.Open,
×
48
            access: FileAccess.Read);
×
49

50
    public bool FileExists(
51
        string fileSubPath)
52
        => File.Exists(
×
53
            Path.Combine(
×
54
                _environment.ContentRootPath,
×
55
                fileSubPath));
×
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc