MDK-SE
MDK-SE copied to clipboard
Minifier causing errors when code had no errors before.
The code didn't initially have errors when compiling in SE. However when I compile in SE after minification, lots of errors appear:

These errors seem to be nearly all methods not found. Perhaps it isn't minifying method names where it should? MDK project here if you wanna take a quick snoop to see if I'm doing something wrong: https://github.com/ksqk34/Autodocking-2
I'm guessing it's because it's a static class function.
public static double VectorAngleBetween(Vector3D a, Vector3D b) //returns radians { if (a.LengthSquared() == 0 || b.LengthSquared() == 0) return 0; else return Math.Acos(MathHelper.Clamp(a.Dot(b) / a.Length() / b.Length(), -1, 1)); }
Comes out as:
public static double ð(Vector3D ï, Vector3D î) { if (ï.LengthSquared() == 0 || î.LengthSquared() == 0) return 0; else return Math.Acos(MathHelper.Clamp(ï.Dot(î) / ï.Length() / î. Length(), -1, 1)); }
but reference is not (obviously) using the minified name.
Also, the code generated is not a crazy minified as I'm used to..
Hmm. the CODE tagging removes some of the white space.. hrmph.
So you think it could be just an issue with static methods? That's a fairly easy fix if that's the case. I'll just turn them all into standard methods as I can find an instantiated version of the classes in all cases.
I have tested that, I removed all static methods, turning them into standard ones. This didn't help I'm afraid, it seems to be an issue with standard methods too.
On reload/rebuild the minified code from your project looks nominal:
(I took out the preserve region for testing)

It's pasting the code back into VS that auto-formats it.. (I'm using Visual Studio 2017).
It still gets the same error.
My minified code looks like this:

Interesting.
All I did was run a Resharper Cleanup Code on your project... and it generated correctly.
There is something about the way you write your code that is nonstandard.
I'm sorry I don't have the energy to figure out the details of how and why this works... but it does. Enclosing the fixed project. Maybe you can figure it out yourself? Or someone else interested?
Thanks for the fixed files. I think I'll download Resharper too. I'll see what changes it makes and maybe I'll gain some insight into the crucial differences. I'm glad there is a fix though.
Thanks for your time on this Malware and Wicorel.