473,748 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("aberhal lo")
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 1638
..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("aberhal lo")
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...@discussio ns.microsoft.co mwrote:
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("aberhal lo")
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...@discussio ns.microsoft.co mwrote:
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("aberhal lo")
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**@discussio ns.microsoft.co mwrote in message
news:0A******** *************** ***********@mic rosoft.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...@discussio ns.microsoft.co mwrote:
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("aberhal lo")
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
2427
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 to find the _current_ reporting page... // // Since I'm now using much time on reporting this compiler bug, please // do also fix the __LINE__ macro. //
7
2677
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 true (not necessarily an internal compiler error, but still an error) This may just a bit OT, but I decided to post it here instead of Microsoft because my question is more directed towards standards... Of course, any other day I would have...
10
2565
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 forgets to implement some method I normally get a compile error(if the class is created in some way of course). When using the Visual Studio 6 compiler however, it does not generate a compile error in this case: - I have a implementing class A...
3
1588
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 have to compile, hit the page, compile again. Every single time. It is driving me batty. Anyone know the solution for this?
19
3579
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 one web presentation tier (Foo.WebFiles). The data tier shall only be accessible thru the business tier so I do NOT want a reference to the data tier in the presentation tier. In the business tier I have a class with the name CategoryItem that...
30
1736
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 Foo("", 0); // Uses Foo(string,MyEnum) constructor instead of Foo(string,object)
2
7037
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 fine, every time. But, if I access on it's public IP, from my office workstation, from home, over the VPN, a test machine on ADSL, or whatever else you please, it fails. But only about 60% of the time. I have tried everything to pin this down....
0
2052
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 increment operator in a class and then defining a derived class and using the derived class. When I try to use the increment operator on an instance of the derived class (as an instance of the derived class, not when used as an instance of the base...
27
3071
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 the source (gcc-4.3.1/gcc/c-common.c) of gcc 4.3.1, is a syntax error. I'm inclined to agree, as it is like no C I have ever met. what is "C_COMMON_FIXED_TYPES (, fract);" supposed to mean? Could it be
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9558
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9331
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8250
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2216
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.