Compiler Warning (level 1) CS1682
Reference to type 'type' claims it is nested within 'nested type', but it could not be found
This error arises when you import references that do not agree with other references or with code you have written. A common way to get this error is to write code that refers to a class in metadata, and then you either delete that class or modify its definition.
C#
// CS1682.cs
// compile with: /target:library /keyfile:mykey.snk
public class A {
public class N1 {}
}
C#
// CS1682_b.cs
// compile with: /target:library /reference:CS1682.dll
using System;
public class Ref {
public static A A1() {
return new A();
}
public static A.N1 N1() {
return new A.N1();
}
}
C#
// CS1682_c.cs
// compile with: /target:library /keyfile:mykey.snk /out:CS1682.dll
public class A {
public void M1() {}
}
The following sample generates CS1682.
C#
// CS1682_d.cs
// compile with: /reference:CS1682.dll /reference:CS1682_b.dll /W:1
// CS1682 expected
class Tester {
static void Main()
{
Ref.A1().M1();
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: