Not
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Error Message
Modifying a method inside the context of a generic type will prevent the debug session from continuing while Edit and Continue is enabled
This error indicates that you tried to modify a method, generic or not, a property, an indexer, an event, an operator, a constructor, or a destructor of a generic type. Edit and Continue does not support this type of change while debugging.
Consider the following code:
static class Utils<T> where T: System.IComparable
{
public static T Max(T item1, T item2)
{
if (item1.CompareTo(item2) > 0)
return item1;
return item2;
}
}
class Program
{
static void Main(string[] args)
{
int max = Utils<int>.Max(10, 20);
}
}
If you add a breakpoint on the line if (item1.CompareTo(item2) > 0), then start debugging and try to change > 0 to >= 0, this error occurs.
To correct this error
Undo the changes, and then continue debugging without the changes.
—or—
On the Debug menu, click Stop Debugging, make the changes, then start a new debugging session.
See Also
Reference
Supported Code Changes (C#)
Edit and Continue (Visual C#)
Concepts
Generics (C# Programming Guide)