As it seems hypens in Managed Properties are still an issue in SharePoint 2016 / 2013. I had an issue with an existing business application and did some tests to find out more.
I created two managed properties "testdummy" and "test-dummy" with exactly the same settings and the same mappings to the crawled property "Title".
If I use "testdummy" and "test-dummy" in a query term (enterprise result page)
I get exactly the same results. Trying the same from the SharePoint Search Query Tool, it also works.
Even using one of those as a refinement property, by editing a refinement panel it also works like a charm.
Until now those properties where created for the exclusive use by external Rest Search calls, and even there (get and post calls), it worked.
But not inside a display template. In order to use the property inside a Display Template I took a copy of an existing display template and added the properties one after another to the ManagedPropertyMapping Setting
Looked good and worked as expected.
Then I tried the same with the test-dummy property.
and verified in the js file
But if I now use that template (no calculation is done with the property, just added to the mapping section), the only response on the page is a correlation ID.
Searching in the ULS Log I can find this information:
The field name 'test-dummy' is not valid. Field names can only contain English letters, digits, the underline character '_', and the punctuation mark '.'
Any idea how I could "escape" that issue in a display template? In any other Use case I have, it works like intended.