I have a method in a C++/WinRT component. It produces the code analysis warning C26800.
The method is an async coroutine. It returns an IAsyncOperation of a projected defined in a MIDL file. It takes as a parameter an AudioGraph object which is a projected type from "Windows.Media.Audio.h". The parameter is declared as "AudioGraph graph", not "AudioGraph const& graph" so that it is copied and not referenced. But when I call a method on it, the code analysis reports a C26800 warning.
I can't figure what to do with this warning. Can I safely ignore it or should I change my code ?
Here is the code for the method :
IAsyncOperation<CompositeInstrument> CompositeInstrument::LoadAsync(AudioGraph graph)
{
MediaSource mediaSource{ MediaSource::CreateFromStream(waveStream, L"audio/x-wav") };
// the following line produces warning C26800: Utilisation d'un objet déplacé : ''graph'' (lifetime.1)
CreateMediaSourceAudioInputNodeResult result{ co_await graph.CreateMediaSourceAudioInputNodeAsync(mediaSource) };
if (result.Status() != MediaSourceAudioInputNodeCreationStatus::Success)
{
// etc...
}
// etc...
co_return compositeInstrument;
}
It was a bug in Visual Studio. It has been fixed in VS 16.10.