How can I mark a c# function by a third party as library as nullable

21 Views Asked by At

A third party lib did not mark their function properly as sometimes returning a null type. Is there a way to tell the c# analyzer that it may be null?

public async Task DoSomething() {
    Thing? thing = await thirdPartyLibInstance.FindThing(); // Return type not marked as nullable
    DoSomethingElse(thing); // c# analyzer/compiler believes this will not be null here but in reality it may be
}
0

There are 0 best solutions below