Window isn't registering component from setContentComponent

So in my MainComponent.cpp I tried to get a new Window going and it pops up fine but the problem is it won’t register any of the components I try to pass into it.
I tried passing a custom Mixing Component which is a mixer with buttons and sliders which didn’t work,
I’ve tried passing in sliders by themselves and buttons by themselves but it wasn’t working.

this is the code in my MainComponent.cpp
tester is the DocumentWindow and has been initialized to

tester(“My name”, juce::Colours::grey, juce::DocumentWindow::TitleBarButtons::allButtons)

then in the MainComponent Constructor I have

tester.setSize(600, 600);

tester.setUsingNativeTitleBar( true );

tester.setContentComponentSize(200, 200);

tester.setConstrainer( nullptr );

juce::Slider sliderTest;

sliderTest.setBounds(20, 20, 30, 70);

sliderTest.setVisible( true );

tester.setContentOwned(&sliderTest, true );

tester.setResizable ( true , true );

tester.setVisible( true );

I had seen on the forum many issues where regarding the declarations of the bounds, but I have declared the bounds already they just seem to not pop up in the Window, but the window will pop up fine.

The setContent* methods can’t make copies of the passed in components (because Components are not copyable). So you need to heap allocate the content component using new or have it as a member variable that keeps it alive. If you have the content component as a local variable, it will just be destroyed at the end of your contructor or equivalent function, and nothing will show.

Thanks it worked.