.net 1.1 to 2.0 - Filestream - error: Overload resolution failed because no accessible 'New' can be

  • Thread starter Thread starter jason
  • Start date Start date
J

jason

Since going to framework 2.0 from 1.1, I'm getting error:

Overload resolution failed because no accessible 'New' can be called
without a narrowing conversion:

On line:

Dim LogInfo As New FileStream("f:\xxx\xxx.log",
FileShare.ReadWrite,FileAccess.Read)

This code was working fine under 1.1

I tried taking the New out, but then I get:
Array bounds cannot appear in type specifiers.

I delete the log file and try again, but the errors persist.
 
Hello (e-mail address removed),

I think that the old code was doing an implicit conversion. This code probably
never shoudl have worked. The second parameter should be a FileMode enumeration,
and the fourth shuold have been the FileShare:

Dim LogInfo as New FileStream("f:\xxx\xxx.log", FileMode.Open, FileAccess.Read,
FileShare.ReadWrite)

Not sure (maybe a VB MVP can correct me), but in 1.1 FileShare.ReadWrite's
value is 3...the same as the FileMode.Open (which is 3). Make any sense?

Thanks,
Shawn Wildermuth
Speaker, Author and C# MVP
http://adoguy.com
 
Yes. That fixes it. Thank you!
Hello (e-mail address removed),

I think that the old code was doing an implicit conversion. This code probably
never shoudl have worked. The second parameter should be a FileMode enumeration,
and the fourth shuold have been the FileShare:

Dim LogInfo as New FileStream("f:\xxx\xxx.log", FileMode.Open, FileAccess.Read,
FileShare.ReadWrite)

Not sure (maybe a VB MVP can correct me), but in 1.1 FileShare.ReadWrite's
value is 3...the same as the FileMode.Open (which is 3). Make any sense?

Thanks,
Shawn Wildermuth
Speaker, Author and C# MVP
http://adoguy.com
 
Back
Top