Problem with is_active_sidebar?

I have registered a sidebar with the following code :

function reg_l_sid(){
     $args = array(
     'name'          => __( 'left-sidebar', 'Tutorial-Blog' ),
     'id'            => 'left-sidebar',
     'description'   => '',
     'class'         => '',
     'before_widget' => '<li id="%1$s" class="widget %2$s">',
     'after_widget'  => '</li>',
     'before_title'  => '<h2 class="widgettitle">',
     'after_title'   => '</h2>' );

register_sidebar( $args );
}
add_action ('widgets_init','reg_l_sid');

and the sidebar is registered, then i added some widgets. then i tried to use the conditional is_active_sidebar to display a message if there are no widgets like this :

if ( is_active_sidebar( 'left-sidebar' ) ) {
     dynamic_sidebar( 'left-sidebar' );
} else {
    echo 'Please add widgets';
}

but it keeps showing the message “Please add widgets”, while as i mentioned that there are widgets have been added. So where is the problem?

Update

To be mentioned that it works fine without the conditional.

Solutions Collecting From Web of "Problem with is_active_sidebar?"

Please try this one,because without id we i don’t think that will work:

  function reg_l_sid()
  {
   $args = array( 'id' => 'sidebar-footer-6','name'=> 'Left-sidebar');
   register_sidebar($args);
  }
  add_action('widgets_init', 'reg_l_sid');

and inside template:

  if (is_active_sidebar('sidebar-footer-6')) {
        dynamic_sidebar('sidebar-footer-6');
   } else {
        echo 'Please add widgets';
   }

Actually the problem has been solved but i don’t know why this happened.. so after using the default WordPress function every thing worked fine, then i manged to delete the args i don’t need ,returning back to using only the name argument …and this was the starting point for me.. after checking every thing worked .. so my be it was a syntax problem but finally no problem with using the name argument only. Now i have this and it works just fine :

function reg_l_sid(){
   $args = array('name'=> __( 'Left-sidebar', 'Tutorial-Blog' ));
   register_sidebar( $args );
}
add_action ('widgets_init','reg_l_sid')

In sidebar :

if ( is_active_sidebar( 'Left-sidebar' ) ) {
     dynamic_sidebar( 'Left-sidebar' );
} else {
    echo 'Please add widgets';
}

I have just put your code in my function file and also create a template to test your code. for me, it’s working fine. Please re-evaluate your things, it might be working.

add_action( 'widgets_init', 'twentyseventeen_widgets_init' );
function reg_l_sid(){
     $args = array(
     'name'          => __( 'left-sidebar', 'Tutorial-Blog' ),
     'id'            => 'left-sidebar',
     'description'   => '',
     'class'         => '',
     'before_widget' => '<li id="%1$s" class="widget %2$s">',
     'after_widget'  => '</li>',
     'before_title'  => '<h2 class="widgettitle">',
     'after_title'   => '</h2>' );

register_sidebar( $args );
}

add_action ('widgets_init','reg_l_sid');

if ( is_active_sidebar( 'left-sidebar' ) ) {
     dynamic_sidebar( 'left-sidebar' );
} else {
    echo 'Please add widgets';
}