Setting shared materials not working?

So, I try to assign material like

someObject.GetComponent<Renderer>().sharedMaterials[0] = coolMaterial

But it doesn't take. I've debugged it and the new material I am trying to assign it to is correct, and the object material remains the same after this line as before. It is an instanced clone, so I don't know if that has to do with it. I even tried .materials too.