question

Anthony-7363 avatar image
0 Votes"
Anthony-7363 asked Anthony-7363 commented

StreamReader causes "ambiguous call to overloaded function" compile error after porting to .NET 5

I've changed our existing .NET Framework (4.6.2) projects to target .NET 5. We have a number of c# libraries that are referenced by a C++/CLI library. When I attempt to compile the C++/CLI library I get the following error

1> XComFileSystem.cpp(77,68): error C2668: 'System::IO::StreamReader::StreamReader': ambiguous call to overloaded function
1> XComFileSystem.cpp(77): message : could be 'System::IO::StreamReader::StreamReader(System::IO::Stream ^,System::Text::Encoding ^,bool,int,bool)'
1> XComFileSystem.cpp(77): message : or 'System::IO::StreamReader::StreamReader(System::IO::Stream ^)'
1> XComFileSystem.cpp(77,68): message : while trying to match the argument list '(System::IO::Stream ^)'

Here's my code...

 System::IO::Stream^ sss;
 StreamReader^ lobFileReader = gcnew StreamReader( sss );

Can anyone suggest how I can get passed this error ?

Thanks

dotnet-runtime
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

II am getting the same error for StreamWriter usage:
error C2668: 'System::IO::StreamWriter::StreamWriter': ambiguous call to overloaded

Did you find any solution for this?

0 Votes 0 ·
Anthony-7363 avatar image Anthony-7363 ChandrashekharJoshi-7445 ·

Hi Chandrashekhar,

I'm using one of the other StreamReader constructors until the issue is fixed.

0 Votes 0 ·

0 Answers