Bug 5630 - Unexpected error: Argument cannot be null. (VBCN99999), returnType(name)
Summary: Unexpected error: Argument cannot be null. (VBCN99999), returnType(name)
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: VisualBasic ()
Version: unspecified
Hardware: PC All
: --- normal
Target Milestone: ---
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2012-06-13 08:09 UTC by gsertgaert
Modified: 2012-07-06 11:43 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-06-13 16:21:22 UTC
Can you attach sample code (or even your project) that shows this problem? From the stack trace it is not possible to deduce what VB code is causing this problem.
Comment 3 gsertgaert 2012-06-19 03:43:24 UTC
I finally tracked down the cause. The compiler acts as if members of a class are available in nested classes. In simple code it only produces a runtime error. After mixing it with generics and properties it makes compiler errors like the one submitted.

Module Module1

	Public Class Test
		
		Public Ambiguous As Integer
		
		Public Class NestedTest
			
			Public Function Impossible() As Integer
				
				Return Ambiguous 'Ambiguous does not exist in this class. The code compiles without error
			End Function
		End Class
	End Class

	Sub Main
		
		Dim instance As New Test.NestedTest
		Dim x As Integer = instance.Impossible
		'Runtime error:
		'Unhandled Exception: System.InvalidProgramException: Invalid IL code in ConsoleApplication1.Module1/Test/NestedTest:Impossible (): IL_0001: ldfld     0x04000001
	End Sub
End Module
Comment 4 Rolf Bjarne Kvinge [MSFT] 2012-07-04 07:03:10 UTC
Thank you for the test case, I can reproduce this.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2012-07-06 11:43:52 UTC
Fixed (master: e5b57bd17baefdf915deaa691c2a2896f45a93b8).