cwtools / cwtools-vscode

A VS Code extension providing language server support for paradox script files using cwtools
https://cwtools.github.io/
Other
90 stars 12 forks source link

Vic 3 file parsing overflow error #79

Open DZappala opened 1 year ago

DZappala commented 1 year ago

Vic3 projects currently do not work using CWTools. Only the syntax highlighting features currently work.

Attempted uninstalling and reinstalling CWTools both automatically through vscode and manually deleting the extension files and reinstalling.

Attempted on both Windows and MacOS platofrms

Upon inspecting Paradox Language Server Logs, I'm met with this error:

[Info  - 12:52:55 PM] repo path "https://github.com/cwtools/cwtools-vic3-config"
[Info  - 12:52:55 PM] New init { processId = Some 36660
  rootUri =
   Some
     file:///c:/Users/[user_redacted]/Documents/Paradox Interactive/Victoria 3/mod/[project_name_redacted]
  initializationOptions =
   Some
     {
  "language": "vic3",
  "isVanillaFolder": false,
  "rulesCache": "c:\\Users\\[user_redacted]\\.vscode\\extensions\\tboby.cwtools-vscode-0.10.7/.cwtools",
  "rules_version": "latest",
  "repoPath": "https://github.com/cwtools/cwtools-vic3-config"
}
  capabilitiesMap =
   map
     [("textDocument.callHierarchy.dynamicRegistration", true);
      ("textDocument.codeAction.dynamicRegistration", true);
      ("textDocument.codeAction.isPreferredSupport", true);
      ("textDocument.codeLens.dynamicRegistration", true);
      ("textDocument.colorProvider.dynamicRegistration", true);
      ("textDocument.completion.completionItem.commitCharactersSupport", true);
      ("textDocument.completion.completionItem.deprecatedSupport", true);
      ("textDocument.completion.completionItem.preselectSupport", true);
      ("textDocument.completion.completionItem.snippetSupport", true); ...]
  trace = Some Off
  workspaceFolders =
   [{ uri =
       file:///c:/Users/[user_redacted]/Documents/Paradox Interactive/Victoria 3/mod/[project_name_redacted]
      name = "[project_name_redacted]" }] }
[Info  - 12:52:56 PM] New configuration { settings =
   {
  "cwtools": {
    "trace": {
      "server": "off"
    },
    "localisation": {
      "languages": [
        "English"
      ],
      "generated_strings": ":0 \"REPLACE_ME\"",
      "replaceme": ""
    },
    "errors": {
      "vanilla": "false",
      "ignore": [],
      "ignorefiles": [
        "README.txt",
        "credits.txt",
        "credits_l_simp_chinese.txt",
        "reference.txt",
        "startup_info.txt"
      ]
    },
    "experimental": true,
    "debug_mode"...}
[Info  - 12:52:56 PM] Cache exists at c:\Users\[user_name_redacted]\.vscode\extensions\tboby.cwtools-vscode-0.10.7/.cwtools/vic3/../.cwb
[Info  - 12:52:56 PM] c:\Users\[user_name_redacted]\Documents\Paradox Interactive\Victoria 3\mod\[project_name_redacted]
[Info  - 12:52:56 PM] Parse docs time: 0
[Diag - 12:52:56] queue length: 0
[Diag - 12:52:56] lint force: true, shallow: false
[Diag - 12:52:56] lint after delayed
[Diag - 12:52:56] queue length: 0
[Info  - 12:52:56 PM] cwtools current rules version: "6740a896a3d8d0f31003d44ee9ddef994bdc29a4"
[Info  - 12:52:56 PM] cwtools new rules version: "6740a896a3d8d0f31003d44ee9ddef994bdc29a4"
[Info  - 12:52:58 PM] Parse cache time: 2494
[Info  - 12:52:58 PM] Workspace roots:
[Info  - 12:52:58 PM] root c:\Users\[user_name_redacted]\Documents\Paradox Interactive\Victoria 3\mod\[project_name_redacted], exists: true
[Info  - 12:52:58 PM] embedded folder Some "c:/Program Files (x86)/Steam/steamapps/common/Victoria 3/game/"
[Info  - 12:52:58 PM] normalised c:/Program Files (x86)/Steam/steamapps/common/Victoria 3/game/
[Info  - 12:52:58 PM] normalised c:/Users/[user_name_redacted]/Documents/Paradox Interactive/Victoria 3/mod/[project_name_redacted]
[Info  - 12:52:59 PM] Parsing 1719 files
System.AggregateException: One or more errors occurred. (Value was either too large or too small for a Decimal.)
 ---> System.OverflowException: Value was either too large or too small for a Decimal.
   at System.Number.ThrowOverflowException(TypeCode type)
   at System.Decimal.DecCalc.VarDecFromR8(Double input, DecCalc& result)
   at CWTools.Parser.SharedParsers.valueF@107-1.Invoke(Double value)
   at FParsec.Primitives.op_BarGreaterGreater@143.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_BarGreaterGreater@143.Invoke(CharStream`1 stream)
   at FParsec.Primitives.attempt@407.Invoke(CharStream`1 stream)
   at CWTools.Parser.SharedParsers.valueCustom@152.Invoke(CharStream`1 stream) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Parser\SharedParsers.fs:line 165
   at FParsec.Primitives.op_LessQmarkGreater@566.Invoke(CharStream`1 stream)
   at FParsec.Primitives.createParserForwardedToRef@947.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_DotGreaterGreater@90.Invoke(CharStream`1 stream)
   at FParsec.Primitives.pipe3@170.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_DotGreaterGreater@90.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_BarGreaterGreater@143.Invoke(CharStream`1 stream)
   at FParsec.Primitives.attempt@407.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessBarGreater@267.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessBarGreater@267.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessQmarkGreater@566.Invoke(CharStream`1 stream)
   at FParsec.Primitives.many@872.Invoke(CharStream`1 stream)
   at CWTools.Parser.SharedParsers.betweenL@20.Invoke(CharStream`1 stream) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Parser\SharedParsers.fs:line 28
   at FParsec.Primitives.op_BarGreaterGreater@143.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessQmarkGreater@566.Invoke(CharStream`1 stream)
   at FParsec.Primitives.createParserForwardedToRef@947.Invoke(CharStream`1 stream)
   at FParsec.Primitives.pipe5@226.Invoke(CharStream`1 stream)
   at FParsec.Primitives.createParserForwardedToRef@947.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessBarGreater@267.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessQmarkGreater@566.Invoke(CharStream`1 stream)
   at FParsec.Primitives.many@872.Invoke(CharStream`1 stream)
   at CWTools.Parser.SharedParsers.betweenL@20.Invoke(CharStream`1 stream) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Parser\SharedParsers.fs:line 28
   at FParsec.Primitives.op_BarGreaterGreater@143.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessQmarkGreater@566.Invoke(CharStream`1 stream)
   at FParsec.Primitives.createParserForwardedToRef@947.Invoke(CharStream`1 stream)
   at FParsec.Primitives.pipe5@226.Invoke(CharStream`1 stream)
   at FParsec.Primitives.createParserForwardedToRef@947.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessBarGreater@267.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessQmarkGreater@566.Invoke(CharStream`1 stream)
   at FParsec.Primitives.many@872.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_DotGreaterGreater@90.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_LessBarGreater@267.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_GreaterGreaterDot@74.Invoke(CharStream`1 stream)
   at FParsec.CharParsers.applyParser[Result,UserState](FSharpFunc`2 parser, CharStream`1 stream)
   at CWTools.Games.ResourceManager`1.parseFileInner(String filetext, String filename) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Game\ResourceManager.fs:line 338
   at CWTools.Games.ResourceManager`1.duration[a](FSharpFunc`2 f) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Game\ResourceManager.fs:line 308
   at <StartupCode$CWTools>.$ResourceManager.func1@1-19[T](ResourceManager`1 this, EntityResourceInput f) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\unknown:line 351
   at CWTools.Games.ResourceManager`1.parseFileThenEntity(ResourceInput file) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Game\ResourceManager.fs:line 351
   at System.Linq.Parallel.SelectQueryOperator`2.SelectQueryOperatorEnumerator`1.MoveNext(TOutput& currentElement, TKey& currentKey)
   at System.Linq.Parallel.PipelineSpoolingTask`2.SpoolingWork()
   at System.Linq.Parallel.SpoolingTaskBase.Work()
   at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose)
   at System.Linq.Parallel.AsynchronousChannelMergeEnumerator`1.MoveNextSlowPath()
   at System.Linq.Parallel.QueryOpeningEnumerator`1.MoveNext()
   at CWTools.Games.ResourceManager`1.updateFiles(FSharpList`1 files) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Game\ResourceManager.fs:line 438
   at CWTools.Games.GameObject`2.initialLoad() in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Game\Game.fs:line 157
   at CWTools.Games.GameObject`2..ctor(GameSettings`1 settings, String game, FSharpList`1 scriptFolders, FSharpFunc`2 computeFunction, FSharpFunc`2 computeUpdateFunction, FSharpFunc`2 localisationService, FSharpFunc`2 processLocalisation, FSharpFunc`2 validateLocalisationCommand, ScopeContext defaultContext, ScopeContext noneContext, Encoding encoding, Encoding fallbackencoding, ValidationManagerSettings`1 validationSettings, FSharpFunc`2 globalLocalisation, FSharpFunc`2 afterUpdateFile, String localisationExtension, RuleManagerSettings`2 ruleManagerSettings) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Game\Game.fs:line 195
   at CWTools.Games.GameObject`2.CreateGame(Tuple`8 settings, FSharpFunc`2 afterInit) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Game\Game.fs:line 225
   at CWTools.Games.VIC3.VIC3Game..ctor(GameSetupSettings`1 setupSettings) in C:\Users\Thomas\Git\cwtools-vscode\paket-files\git\localfilesystem\cwtools\CWTools\Game\VIC3\VIC3Game.fs:line 325
   at Main.Lang.GameLoader.loadVIC3(ServerSettings serverSettings) in C:\Users\Thomas\Git\cwtools-vscode\src\Main\GameLoader.fs:line 405
   at Main.Program.Server.processWorkspace(FSharpOption`1 uri) in C:\Users\Thomas\Git\cwtools-vscode\src\Main\Program.fs:line 482
[Diag - 12:53:39] queue length: 0
[Diag - 12:53:39] lint force: true, shallow: false
[Diag - 12:53:39] lint after delayed
[Diag - 12:53:39] queue length: 0
[Diag - 12:53:39] queue length: 0
[Diag - 12:53:39] lint force: false, shallow: true
[Diag - 12:53:39] queue length: 0
DZappala commented 1 year ago

Let me know if any other information would be helpful to provide.

tboby commented 1 year ago

What was the number? :)

The decimal type should cover "79,228,162,514,264,337,593,543,950,335 to negative 79,228,162,514,264,337,593,543,950,335" with a maximum of 28/29 digits.

I thought that paradox games use fixed point numbers, so I assumed it wouldn't support enough precision to break that limit, but apparently not!?