This project is read-only.


Regression: "assembly is not referenced" error is NOT reported when base exception is not referenced


Repro steps
a. Create Project 1 that defines a base exception
public class GeneralException : Exception
b. Create Project 2 that defines a derived exception
public class SpecificException : GeneralException
and add a reference of Project 1
c. Create Project 3 to catch SpecificException
            try { }
            catch (SpecificException) { }
and only add reference of Project 2. DO NOT add reference of Project 1.
d. Compile the Project 3, and got error
The type caught or thrown must be derived from System.Exception

Expected result
In VS 2013 without Roslyn installed, it also reports error
The type '....GeneralException' is defined in an assembly that is not referenced. You must add a reference to assembly 'BaseException ... . Via this message, it's very easy to fix the error.

Actual result
In VS 2013 with Roslyn installed, it only reports The type caught or thrown must be derived from System.Exception, which is misleading in such situation.
Please see attachment for more.

file attachments


SSL wrote May 28, 2014 at 4:03 AM

Once this is fixed, it should also show a quick fix to add the missing reference.

angocke wrote Oct 14, 2014 at 1:41 AM

Fixed in changeset 85aa8d3bd928082e7918bb1e7aa6f119afda37fb