Is there a difference in the use of hook_preprocess_HOOK() Is there a difference in the use of hook_preprocess_HOOK()?

In Drupal 8 when I use :


hook_preprocess_page 
hook_preprocess_node 
hook_preprocess_block


All my Implements for page, node or block work good. 

But when I use hook_preprocess_menu some staff don't want to work, what work in preprocess function up.

For example:

This work perfect

function theme_name_preprocess_page(&amp;$variables) {
  $variables['logopath'] = '/' . drupal_get_path('theme','theme_name') . '/logo.png';
}


But this don't work.

function theme_name_preprocess_menu(&amp;$variables, $hook) {
$variables['logopath'] = '/' . drupal_get_path('theme','theme_name') . '/logo.png';
  }
If you use:

function theme_name_preprocess_menu(&amp;$variables, $hook) {
  $variables['logopath'] = '/' . drupal_get_path('theme','theme_name') . '/logo.png';
}


The hook is menu, so Drupal will look for menu.html.twig, if you define any var inside this preprocess you only be able to use in menu.html.twig. Look the Hook at your theme suggestions comments, if you see 'block' you will need use theme_name_preprocess_block instead.