Skip to content

Intermittent NullReferenceException in MediaDevice.GetDevices() #156

@blazej-kosmowski

Description

@blazej-kosmowski

Describe the bug
Some users intermittently experience a NullReferenceException when calling MediaDevice.GetDevices(). This exception does not occur for all users, and the cause is not entirely clear.

To Reproduce

1.	Call `MediaDevice.GetDevices()` in a system with portable devices connected.
2.	For certain users, a `NullReferenceException` is thrown.

Expected behavior
The method should return a valid list of MediaDevice objects or an empty list if no devices are available.

Device
Various devices and operating systems (details unknown).

Version:
1.10.0.0.

Additional context
It is possible that deviceManager is not properly initialized, or deviceIds may contain null values. Adding null checks for both deviceManager and deviceIds in the GetDevices() method could resolve this issue. I can prepare a PR for this case if you would like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions