Wednesday, January 10, 2018

VS project "Optimized Code" :: Cannot obtain value of local or argument as it is not available at this instruction pointer

While debugging an existing code in VS 2015 tried to "watch" a couple of variables and encountered with below message without showing the values:
"Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away"

To fix it and get rid of optimization to be able to see the values and also keep debugging in steps without jumping between lines because of optimized code then I unchecked the [Optimize Code]:

Project Properties --> under Build --> Unchecked the [Optimize Code] checkbox.
In the Advanced Options in the project build tab, I set the the "Debug Info" combo to "Full".

Share/Bookmark

Tuesday, January 9, 2018

The database principal owns a schema in the database, and cannot be dropped

SQL Error: "The database principal owns a schema in the database, and cannot be dropped" To fix the issue, we need to find out the userId is owned which schema(s).
SELECT name FROM sys.schemas WHERE principal_id = USER_ID('theUserName')

Then you can assign the schema(s) to dbo to release the user from owning them.
ALTER AUTHORIZATION ON SCHEMA::SchemaName TO dbo


Share/Bookmark