Error message: “Attempted to read or write protected memory. This is often an indication that other memory is corrupt”. I experienced this error message a few times.
It happened in BIDS, when I edited a named query, making a mistake by removing a column from the subquery. The column was removed from the main query automatically by BIDS. As a result, the dimension attribute has no column for its source. After this, any attempt to edit the named query ended up with the above error message.
The solution? I tried to restart PC but it didn’t help. Recreating the dim and the named query works. I deleted the dimension and the named query, then close and reopen the solution. Then I recreated the named query and the dimension.
PS. I tried unchecking the option for “Suppress JIT optimization on module load” as mentioned here, but it didn’t work.