malforge / mdk2

MIT License
61 stars 3 forks source link

Full minification failing error #50

Open stolliemods opened 2 days ago

stolliemods commented 2 days ago

Hi,

I'm not sure what information I need to provide, I'm a pretty amateur coder. When I use Lite the script minifies just fine.

When I try to Full I get the below error. I've tried using all Explicit types in the script and removing any mention of 'var' in the entire script and that error still shows up.

Is there anything else I can look at to see what's going wrong?

1>Starting symbol renaming... 1>Symbol renaming complete in 00:00:00.8662093 1>Writing intermediate symbol map to C:\Users\cheyn\source\repos\AutoDockingUpdatedMDK\obj\symbol.map 1>Compilation failed with errors. 1>The contextual keyword 'var' may only appear within a local variable declaration or in script code 1>'object' does not contain a definition for 'Value' and no accessible extension method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) 1>'object' does not contain a definition for 'Value' and no accessible extension method 'Value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) 1>Implicitly-typed variables must be initialized 1>Implicitly-typed variables must be initialized 1>C:\Users\cheyn.nuget\packages\mal.mdk2.pbpackager\2.0.13\build\Mal.Mdk2.PbPackager.props(18,9): error MSB3073: The command ""C:\Users\cheyn.nuget\packages\mal.mdk2.pbpackager\2.0.13\build..\tools\mdk.exe" pack "C:\Users\cheyn\source\repos\AutoDockingUpdatedMDK\AutoDockingUpdatedMDK.csproj" -configuration Debug -interactive" exited with code -1. 1>Done building project "AutoDockingUpdatedMDK.csproj" -- FAILED.

malware-dev commented 2 days ago

First; make sure you have everything up to date (see wiki). If the error still occurs, you can try to enable "trace" mode in the .ini file to get more information, and a whole bunch of intermediate code files. Please try to narrow down where the error actually occurs. It seems to me like the minifier is trying to be "smart" and replaces a type reference with var somewhere it's not allowed to.

stolliemods commented 2 days ago

Thanks, I've confirmed I needed to update the MDK2 Templates. Nuget packages is up to date, I did that earlier today and confirmed no further update pending as I write this.

I turned on trace mode previously which is where that above log information came from. I've had a look through the intermediate files and can't see where it's going wrong. The only things I see are: -

  1. The WhitespaceTrimmer intermediate file looks like it worked.
  2. TypeSorter seems to have worked, the Classes are in alphabetical order.
  3. Symbol.map appears to be populated with a symbol against everything.
  4. It seems to be failing at the point of mapping those symbols to the intermediate script.

Is there any way for me to see specfically which symbol it fails at, see any more debugging info or check which type references should not be changed and if they are in the symbol map?

malware-dev commented 2 days ago

No, the way this usually is done is to try to see where it fails in the processed code vs where that is in the unprocessed code. It would not be in the symbol map as it's not renaming anything in this case, simply trying to use var instead of the type itself, to shorten it.

It's directly related to a specific way you write your code, which is why it needs to be narrowed down so I can fix it.

malware-dev commented 2 days ago

I will help you if that's the only option, but I beg you to try for yourself first. I don't have much free time to work on this project, so the more you guys help me out, the better for all of us 🙏

stolliemods commented 2 days ago

All good mate, dont stress, I'll try and narrow it down to where its happening, thanks for your help!

Worse case scenario I'll have to refactor and use less descriptive method and variable names 😄

malware-dev commented 1 day ago

I'd prefer to be able to fix the problem than you having to refactor, since someone else might be getting the issue and there's already two issues I have no good solutions for :P