When I run the example program below (just a MVP of my actual issue), I get a bad_weak_ptr exception. I'd suppose it has something to do with the fact that `this` for `Resource` isn't fully created yet by the time we're calling shared_from_this? But that's just a guess, since if I put it not-in-the-constructor, I think all is well.
You can only call shared_from_this() once the object is being managed by an std::shared_ptr. While inside the constructor, new hasn't even returned yet, let alone had its return value assigned to any std::shared_ptrs. So in other words, there's no way to call shared_from_this() from the same object's constructor.
More generally, calling this->shared_from_this() from the class is risky, because the object might not have even been allocated on the heap and you have no control over that inside the class. If someone allocates an instance of the class on the stack and then calls a member function that for whatever reason calls shared_from_this(), you'll run into the same issue.