All examples works, I guess you made some simple mistake - like wrong file name, not all files are created correctly, some missing lines etc.
Can you please post exact folder/file structure of addon you are testing and content of all files?
Something like:
+FooAddon\
|--FooAddon.txt
|--FooAddon.lua
FooAddon.txt
Code:
## Title: Foo Addon
## APIVersion: 100010
FooAddon.lua
FooAddon.lua
Lua Code:
local function OnPlayerCombatState(event, inCombat)
d((inCombat and "Entering" or "Exiting") .. " combat")
end
EVENT_MANAGER:RegisterForEvent("FooAddon_CombatState", EVENT_PLAYER_COMBAT_STATE, OnPlayerCombatState)