First of all you should check the type of your value. You can do it by calling obj.GetType() method (either in your code directly or in Immediate window).
If it is int then you can do:
uint u = (uint) (int) obj;
Please note that it differs from your cast because it casts to int and then converts to uint while you were trying to cast to uint. int cannot be cast to uint and that is why you get the InvalidCastException. int can be only converted to uint. It is confusing that both conversion and cast operators look same in code: u = (uint) x.
Easier thing you can do is calling a specific method from Convert class:
uint u = Convert.ToUInt32(x);