After the great success of The Awful Truth (1937), McCarey signed Cary Grant and Irene Dunne for the film without a script.
He was to have directed My Favorite Wife, as well, but after his near-fatal car accident Garson Kanin was assigned as director. "
On My Favorite Wife," recalled Gail Patrick, "we were desperately trying to be funny as our producer, Leo McCarey, lay at death's door from an automobile crash.
He recovered but I never thought we entered into the spirit of that one.
We couldn't—we were waiting for bulletins from the hospital."
A number of pre-production conferences took place in the hospital, and McCarey recovered sufficiently to visit the set two or three weeks into filming.

When the shooting was finished McCarey edited the film, and a preview was arranged.
McCarey later recalled that "after about five reels the picture took a dip, and for about two reels or more it wasn't as funny as what preceded it ... it was a lot of unraveling of a tricky plot."
A second preview confirmed that the film broke down at exactly the same point.

So the cast was dismissed, the writers went home, the director went back to New York and I sat there with the cutter trying to figure out what to do to save the picture. ...
Then I got the wildest idea I ever had.
There was a judge in the opening who was very funny, and he dropped out of the picture, and I decided to bring him back.
What we actually did was to tell the judge our story problems in the picture and have him comment on them.
And it was truly great.
It became the outstanding thing in the picture.

McCarey brought Kanin and one of the other writers back, and wrote the judge's dialogue himself—with help from Gail Patrick, who had studied law.
One reel was shot and two or three were pulled.
When the film was previewed again, it worked.

Patrick later said she felt that the resolution of the film should have included a romance between her character, Bianca, and Stephen Burkett (Randolph Scott). "
I suggested that," Patrick said, "but the director [Garson Kanin] said I was going too far."
After the great success of The Awful Truth (1937), McCarey signed Cary Grant and Irene Dunne for the film without a script. He was to have directed My Favorite Wife, as well, but after his near-fatal car accident Garson Kanin was assigned as director. "On My Favorite Wife," recalled Gail Patrick, "we were desperately trying to be funny as our producer, Leo McCarey, lay at death's door from an automobile crash. He recovered but I never thought we entered into the spirit of that one. We couldn't—we were waiting for bulletins from the hospital." A number of pre-production conferences took place in the hospital, and McCarey recovered sufficiently to visit the set two or three weeks into filming.
When the shooting was finished McCarey edited the film, and a preview was arranged. McCarey later recalled that "after about five reels the picture took a dip, and for about two reels or more it wasn't as funny as what preceded it ... it was a lot of unraveling of a tricky plot." A second preview confirmed that the film broke down at exactly the same point.
So the cast was dismissed, the writers went home, the director went back to New York and I sat there with the cutter trying to figure out what to do to save the picture. ... Then I got the wildest idea I ever had. There was a judge in the opening who was very funny, and he dropped out of the picture, and I decided to bring him back. What we actually did was to tell the judge our story problems in the picture and have him comment on them. And it was truly great. It became the outstanding thing in the picture.
McCarey brought Kanin and one of the other writers back, and wrote the judge's dialogue himself—with help from Gail Patrick, who had studied law. One reel was shot and two or three were pulled. When the film was previewed again, it worked.
Patrick later said she felt that the resolution of the film should have included a romance between her character, Bianca, and Stephen Burkett (Randolph Scott). "I suggested that," Patrick said, "but the director [Garson Kanin] said I was going too far."
My Favorite Wife