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

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.
 
S

Shawn Wildermuth (C# MVP)

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
 
J

jason

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top