By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,400 Members | 1,195 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,400 IT Pros & Developers. It's quick & easy.

.net 1.1 to 2.0 - Filestream - error: Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:

P: n/a
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.

Jul 17 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello ja***@cyberpine.com,

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

Jul 17 '06 #2

P: n/a
Yes. That fixes it. Thank you!

Shawn Wildermuth (C# MVP) wrote:
Hello ja***@cyberpine.com,

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
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.
Jul 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.