473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

VB.NET compiler does not find type error at compiletime

Here the facts as code sample:

Public Class Class1
Sub ABC(ByVal item As IUnit)
End Sub
End Class

Public Interface IUnit ' or any other Interface
ReadOnly Property Heureka() As Activator
ReadOnly Property Reference() As String
ReadOnly Property Name() As String
End Interface

This client is calling ABC the wrong way!
Public Class Class2
Sub test()
Dim C1 As New Class1
C1.ABC("aberhallo")
End Sub
End Class

the .NET 2.0 Compiler does not see this type error at compiletime but at
runtime!
We tried sharpening the compiler with all potential options, but no success.

(this kind of bug is produced many times by the VB6 to .NET migration tool -
which is a serious issue if you have about 700 classes to check ...)

Does someone know what went wrong here - or even better to get around this?

--
PG
May 5 '07 #1
4 1628
..NET 2003, fw 1.1 (sp1, option strict on) catches this error. I know it is a
step backwards, but maybe you could use .NET 2003 as a migration tool.

"PitG" wrote:
Here the facts as code sample:

Public Class Class1
Sub ABC(ByVal item As IUnit)
End Sub
End Class

Public Interface IUnit ' or any other Interface
ReadOnly Property Heureka() As Activator
ReadOnly Property Reference() As String
ReadOnly Property Name() As String
End Interface

This client is calling ABC the wrong way!
Public Class Class2
Sub test()
Dim C1 As New Class1
C1.ABC("aberhallo")
End Sub
End Class

the .NET 2.0 Compiler does not see this type error at compiletime but at
runtime!
We tried sharpening the compiler with all potential options, but no success.

(this kind of bug is produced many times by the VB6 to .NET migration tool -
which is a serious issue if you have about 700 classes to check ...)

Does someone know what went wrong here - or even better to get around this?

--
PG
May 5 '07 #2
On May 5, 3:27 am, PitG <P...@discussions.microsoft.comwrote:
Here the facts as code sample:

Public Class Class1
Sub ABC(ByVal item As IUnit)
End Sub
End Class

Public Interface IUnit ' or any other Interface
ReadOnly Property Heureka() As Activator
ReadOnly Property Reference() As String
ReadOnly Property Name() As String
End Interface

This client is calling ABC the wrong way!
Public Class Class2
Sub test()
Dim C1 As New Class1
C1.ABC("aberhallo")
End Sub
End Class

the .NET 2.0 Compiler does not see this type error at compiletime but at
runtime!
We tried sharpening the compiler with all potential options, but no success.

(this kind of bug is produced many times by the VB6 to .NET migration tool -
which is a serious issue if you have about 700 classes to check ...)

Does someone know what went wrong here - or even better to get around this?

--
PG
Do you have option strict turned on? My guess is no.

--
Tom Shelton

May 5 '07 #3
Hi Tom,

you are right - i did not set the Option Strict ON for this simple example
code.

BUT: the Project itselft was worked on with Option Strict ON set at project
level and there is no message! (i just rechecked)

The reason for not finding the bugs is a automatically (by the converter)
placed statement on each code file of:
Option Strict Off

which overrides the central settings of Option Strict ON.

So thanks - i could go and "hunting bugs"

--
PG
"Tom Shelton" wrote:
On May 5, 3:27 am, PitG <P...@discussions.microsoft.comwrote:
Here the facts as code sample:

Public Class Class1
Sub ABC(ByVal item As IUnit)
End Sub
End Class

Public Interface IUnit ' or any other Interface
ReadOnly Property Heureka() As Activator
ReadOnly Property Reference() As String
ReadOnly Property Name() As String
End Interface

This client is calling ABC the wrong way!
Public Class Class2
Sub test()
Dim C1 As New Class1
C1.ABC("aberhallo")
End Sub
End Class

the .NET 2.0 Compiler does not see this type error at compiletime but at
runtime!
We tried sharpening the compiler with all potential options, but no success.

(this kind of bug is produced many times by the VB6 to .NET migration tool -
which is a serious issue if you have about 700 classes to check ...)

Does someone know what went wrong here - or even better to get around this?

--
PG

Do you have option strict turned on? My guess is no.

--
Tom Shelton

May 5 '07 #4
This is just one more example of why you are actually better off using
copy/paste to convert VB 6 code. More VB 6 code will actually convert
better without the project converter.

Mike.
"PitG" <Pi**@discussions.microsoft.comwrote in message
news:0A**********************************@microsof t.com...
Hi Tom,

you are right - i did not set the Option Strict ON for this simple example
code.

BUT: the Project itselft was worked on with Option Strict ON set at
project
level and there is no message! (i just rechecked)

The reason for not finding the bugs is a automatically (by the converter)
placed statement on each code file of:
Option Strict Off

which overrides the central settings of Option Strict ON.

So thanks - i could go and "hunting bugs"

--
PG
"Tom Shelton" wrote:
>On May 5, 3:27 am, PitG <P...@discussions.microsoft.comwrote:
Here the facts as code sample:

Public Class Class1
Sub ABC(ByVal item As IUnit)
End Sub
End Class

Public Interface IUnit ' or any other Interface
ReadOnly Property Heureka() As Activator
ReadOnly Property Reference() As String
ReadOnly Property Name() As String
End Interface

This client is calling ABC the wrong way!
Public Class Class2
Sub test()
Dim C1 As New Class1
C1.ABC("aberhallo")
End Sub
End Class

the .NET 2.0 Compiler does not see this type error at compiletime but
at
runtime!
We tried sharpening the compiler with all potential options, but no
success.

(this kind of bug is produced many times by the VB6 to .NET migration
tool -
which is a serious issue if you have about 700 classes to check ...)

Does someone know what went wrong here - or even better to get around
this?

--
PG

Do you have option strict turned on? My guess is no.

--
Tom Shelton



May 10 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Alf P. Steinbach | last post by:
// As usual the error message directs one to the report the bug. // // And as usual there is absolutely no way to do so without paying for // the privilege... // // Or using three or four hours...
7
by: Matthew Del Buono | last post by:
Don't try to solve the problem. I've found a way -- around or fixing it. I'm just curious as to whether this is Microsoft's problem in their compiler or if there's a standard saying this is to be...
10
by: Bjorn | last post by:
I'm using interfaces in C++ by declaring classes with only pure virtual methods. If then someone wants to implement the interface they needs to inherit from the class. If the implementing class...
3
by: cameron | last post by:
I compile my project. No errors. Then I hit my page and I get an Error in Application "/" I change nothing and recompile. Works fine. If I compile twice in a row, still get the error. I...
19
by: Martin Oddman | last post by:
Hi, I have a compiling problem. Please take a look at the code below. I have an application that is built upon three tiers: one data tier (Foo.DataManager), one business tier (Foo.Kernel) and...
30
by: Philippe Bertrand | last post by:
Is this a bug in the C# compiler or CLR runtime? enum MyEnum { ZERO = 0, ONE = 1, TWO = 2 } class Foo { public Foo(string,object) { ... } public Foo(string,MyEnum) { ... } } Foo f = new...
2
by: mudge | last post by:
Hi, I'm getting some very strange problems with some C# code. We're running an ASP.NET application on a local server in a DMZ. If I access it using the internal address, the application works...
0
by: erik.erikson | last post by:
I am getting a compiler error that I can't well explain or even understand the origin of (though I boiled it down close...). Below is a bare-bones example. What I am doing is defining the...
27
by: Dave | last post by:
I'm having a hard time tying to build gcc 4.3.1 on Solaris using the GNU compilers. I then decided to try to use Sun's compiler. The Sun Studio 12 compiler reports the following code, which is in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.