Spurious unitialised variable error CS0165

Bug #392342 reported by Chris Halse Rogers on 2009-06-25
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mono
Fix Released
Medium
mono (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: mono

This seems to be a Mono 2.4 regression. gmcs 2.4.0.0 will fail to compile the attached code. The code this testcase was reduced from (GNOME-Do Flickr plugin) builds fine on mono 2.0.

The bug seems to require the IEnumerable<object> return, the using () statement, and the non-void constructor call.

ProblemType: Bug
Architecture: amd64
Date: Fri Jun 26 09:10:18 2009
DistroRelease: Ubuntu 9.10
Package: mono-gmcs 2.4+dfsg-5
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_AU.UTF-8
 SHELL=/bin/zsh
ProcVersionSignature: Ubuntu 2.6.30-10.12-generic
SourcePackage: mono
Uname: Linux 2.6.30-10-generic x86_64

Chris Halse Rogers (raof) wrote :

Created an attachment (id=300508)
Test case

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.0.11) Gecko/2009060309 Ubuntu/9.04 (jaunty) Firefox/3.0.11

A bug has been reported in Ubuntu which appears to be cause upstream - see https://bugs.edge.launchpad.net/ubuntu/+source/mono/+bug/392342

The test case attached here, from that bug report, fails to build on 2.4.0 but built okay on 2.0.1

Reproducible: Always

Steps to Reproduce:
1.Build attached
Actual Results:
test2.cs(33,81): error CS0165: Use of unassigned local variable `tags'

Expected Results:
Compilation

Changed in mono:
status: Unknown → Confirmed

For added strangeness that will possibly help you track this down I have the following snippets of my attempts to work around this bug in the GNOME Do plugins code:

This snippet builds:
Services.Application.RunOnThread ( () => {
 /* Mono 2.4 bug hack
  * This can't use using () due to some crazy-wierd scoping problem.
  * See https://bugzilla.novell.com/show_bug.cgi?id=516676 for details.
  */
 IEnumerable<IFileItem> temp = uploads;
 UploadPool uploadQueue = new UploadPool (tags);
 try {
  foreach (IFileItem photo in uploads)
               uploadQueue.EnqueueUpload (photo);
     uploadQueue.BeginUploads ();
 } finally {
  uploadQueue.Dispose ();
 }
});
This snippet:
Services.Application.RunOnThread ( () => {
 /* Mono 2.4 bug hack
  * This can't use using () due to some crazy-wierd scoping problem.
  * See https://bugzilla.novell.com/show_bug.cgi?id=516676 for details.
  */
 UploadPool uploadQueue = new UploadPool (tags);
 IEnumerable<IFileItem> temp = uploads;
 try {
  foreach (IFileItem photo in uploads)
   uploadQueue.EnqueueUpload (photo);

  uploadQueue.BeginUploads ();
 } finally {
  uploadQueue.Dispose ();
 }
});
fails, with "error CS0165: Use of unassigned local variable `uploads'"

Jo Shields (directhex) on 2009-07-17
Changed in mono (Ubuntu):
status: New → Confirmed
Changed in mono:
importance: Unknown → Medium

Reassigning to Miguel to drive further resolution...

Fixed in master

Changed in mono:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.