New issue report by azizatif:
What steps will reproduce the problem?
1. Call Enumerable.Cast<T> with a null source, as in
Enumerable.Cast<object>(null)
What is the expected output? What do you see instead?
The expected output is that the call to the Cast method throws
ArgumentNullException immediately, but instead, the exception is not
thrown until the first call to MoveNext on the enumerator. All other
operators that have deferred execution semantics exhibit the same problem.
The actual implementation of LINQ to Object, as found in System.Core.dll,
throws argument exceptions when the method corresponding to the operator
with deferred semantics is called.
Below is a demonstration of the observed problem:
IronPython 1.1.2 (1.1.2) on .NET 2.0.50727.3053
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import clr
>>> clr.AddReferenceToFileAndPath(r'C:\BackLINQ\bin\Debug\BackLinq.dll')
>>> from System.Linq import Enumerable
>>> # Should have thrown ArgumentNullException already
>>> e = Enumerable.Cast[object](None)
>>> list(e)
Traceback (most recent call last):
File , line 0, in <stdin>##20
File , line 0, in Initialize##28
File c:\BackLINQ\src\Enumerable.cs, line 74, in MoveNext
File c:\BackLINQ\src\Enumerable.cs, line 1609, in CheckNotNull
TypeError: Value cannot be null.
Parameter name: source
CLR Exception:
ArgumentNullException
:
Value cannot be null.
Parameter name: source
Issue attributes:
Status: Accepted
Owner: azizatif
Labels: Type-Defect Priority-High Component-Logic
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
Comment #1 by azizatif:
The following lines should be reversed:
>>> # Should have thrown ArgumentNullException already
>>> e = Enumerable.Cast[object](None)
as in:
>>> e = Enumerable.Cast[object](None)
>>> # Should have thrown ArgumentNullException already
The full corrected demo is:
IronPython 1.1.2 (1.1.2) on .NET 2.0.50727.3053
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import clr
>>> clr.AddReferenceToFileAndPath(r'C:\BackLINQ\bin\Debug\BackLinq.dll')
>>> from System.Linq import Enumerable
>>> e = Enumerable.Cast[object](None)
>>> # Should have thrown ArgumentNullException already
>>> list(e)
Traceback (most recent call last):
File , line 0, in <stdin>##20
File , line 0, in Initialize##28
File c:\BackLINQ\src\Enumerable.cs, line 74, in MoveNext
File c:\BackLINQ\src\Enumerable.cs, line 1609, in CheckNotNull
TypeError: Value cannot be null.
Parameter name: source
CLR Exception:
ArgumentNullException
:
Value cannot be null.
Parameter name: source
Comment #2 by azizatif:
(No comment was entered for this change.)
Issue attribute updates:
Status: Started
Comment #3 by azizatif:
Fixed in r109.
Issue attribute updates:
Status: Fixed