Description:
If two scripts have the same name, a generic crash will occur on server start-up during the SwapScriptContext
Current behaviour:
The server crashes on startup with the following log:
https://gist.github.com/joshwhedon/7856875a452b56c4d7d4ff0a8c2ff7d5
Expected behaviour:
The server used to fail to start with a specific error indicating which script is duplicated, allowing to easily pinpoint the issue. IT seems that in the past 2 years (sorry first time I merge in a long time) that feature has been removed.
Steps to reproduce the problem:
Branch(es):
3.3.5, probably both
TC rev. hash/commit:
dbd8b3fc63 ("Core/Logs: Allow to log startup logs into Database appender", 2019-06-06)
Operating system: Windows
are you building scripts in static or dynamic mode ? hotswap enabled/disabled ?
I tried all the script modes (in the CMake you mean I guess ?) and all of them were causing the same crash (except none I guess because it does not prepare any script at all).
I am not sure what hotswap is and how you enable / disable it
@Naios is this because of the changes required for hotswap ?
It always happened (even before hotswap).
2 different scripts cant have same name.
Script name need be unique for each creature/spell.
1 Spell can have multiple scripts signed (it work fine)
Why you want put 2 scripts with exactly same name? wtf?
@Keader the issue isnt about being able (or not) to have 2 scripts with same name, its that error logging sucks.
Yup what Shauren says, the problem I encountered was the lack of actual validation for that situation. It just crashes, with no apparent way to find out the script responsible (even with breakpoints).
I got an error message in the console before the crash:
Script 'spell_dk_acclimation' already assigned with the same script name, so the script can't work.
callstack:
worldserver.exe!Trinity::Abort(const char * file, int line, const char * function) Line 128 C++
worldserver.exe!SpecializedScriptRegistry::AddScript(SpellScriptLoader * script) Line 788 C++
worldserver.exe!SpellScriptLoader::SpellScriptLoader(const char * name) Line 2127 C++
worldserver.exe!test2::test2() Line 44 C++
worldserver.exe!AddCustomScripts() Line 66 C++
worldserver.exe!AddScripts() Line 67 C++
worldserver.exe!ScriptMgr::Initialize() Line 1045 C++
worldserver.exe!World::SetInitialWorldSettings() Line 2056 C++
worldserver.exe!main(int argc, char * * argv) Line 255 C++

Turns out "static" scripts always showed the error just fine (even if this issue has only 1 crashlog and the author said he tried all modes)
The crashlog in the issue description is from "dynamic" scripts
with "HotSwap.Enabled = 1" it shows the same message
Most helpful comment
@Keader the issue isnt about being able (or not) to have 2 scripts with same name, its that error logging sucks.