windward-studios / ikvm8

Other
173 stars 36 forks source link

InvalidOperationException When Compiling Google's Closure Compiler JAR #10

Open wessleym opened 5 years ago

wessleym commented 5 years ago

.\ikvmc.exe .\closure-compiler-v20190819.jar This command results in this output:

IKVM.NET Compiler version 8.5.0.3
Copyright (C) 2002-2015, 2018 Jeroen Frijters
http://www.ikvm.net/

note IKVMC0004: Using main class "com.google.javascript.jscomp.CommandLineRunner" based on jar manifest
note IKVMC0002: Output file is "closure-compiler-v20190819.exe"
warning IKVMC0100: Class "org.apache.tools.ant.Task" not found

*** INTERNAL COMPILER ERROR ***

PLEASE FILE A BUG REPORT FOR IKVM.NET WHEN YOU SEE THIS MESSAGE

ikvmc, Version=8.5.0.3, Culture=neutral, PublicKeyToken=null
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
4.0.30319.42000 64-bit

System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at IKVM.Internal.Boxer.EmitBox(CodeEmitter ilgen, TypeWrapper tw)
   at IKVM.Internal.LambdaMetafactory.EmitDispatch(FinishContext context, TypeWrapper[] args, TypeBuilder tb, MethodWrapper interfaceMethod, TypeWrapper[] implParameters, ConstantPoolItemMethodHandle implMethod, ConstantPoolItemMethodType instantiatedMethodType, FieldBuilder[] capturedFields)
   at IKVM.Internal.LambdaMetafactory.CreateConstructorAndDispatch(FinishContext context, ConstantPoolItemInvokeDynamic cpi, TypeBuilder tb, List`1 methods, TypeWrapper[] implParameters, ConstantPoolItemMethodType samMethodType, ConstantPoolItemMethodHandle implMethod, ConstantPoolItemMethodType instantiatedMethodType, Boolean serializable)
   at IKVM.Internal.LambdaMetafactory.EmitImpl(FinishContext context, ClassFile classFile, ConstantPoolItemInvokeDynamic cpi, BootstrapMethod bsm, CodeEmitter ilgen)
   at IKVM.Internal.LambdaMetafactory.Emit(FinishContext context, ClassFile classFile, Int32 constantPoolIndex, ConstantPoolItemInvokeDynamic cpi, CodeEmitter ilgen)
   at Compiler.Compile(Block block, Int32 startIndex)
   at Compiler.Compile(FinishContext context, TypeWrapper host, DynamicTypeWrapper clazz, MethodWrapper mw, ClassFile classFile, Method m, CodeEmitter ilGenerator, Boolean& nonleaf)
   at IKVM.Internal.DynamicTypeWrapper.FinishContext.CompileConstructorBody(FinishContext context, CodeEmitter ilGenerator, Int32 methodIndex)
   at IKVM.Internal.DynamicTypeWrapper.FinishContext.FinishImpl()
   at IKVM.Internal.DynamicTypeWrapper.JavaTypeImpl.FinishCore()
   at IKVM.Internal.DynamicTypeWrapper.JavaTypeImpl.Finish()
   at IKVM.Internal.AotTypeWrapper.Finish()
   at IKVM.Internal.DynamicClassLoader.FinishAll()
   at IKVM.Internal.CompilerClassLoader.Compile(String runtimeAssembly, List`1 optionsList)
   at IkvmcCompiler.Compile(String[] args)
   at IkvmcCompiler.Main(String[] args)

The InvalidOperationException above is thrown from the last line of IKVM.Internal.Boxer.EmitBox. I modified the code so I could inspect the program's state, and tw is null. Thus, no match is found for null, and the InvalidOperationException gets thrown.

ghost commented 5 years ago

Hi @wessleym - Can you please branch, fix this, and then submit as a Pull Request?

thanks - dave

wessleym commented 5 years ago

@DavidThi808, are you asking me to make a fork and fix the bug? I would like to help, but I don't know how to fix the bug. tw is passed into the EmitBox method as null. I don't know if null is valid or not for tw. For this circumstance, I would guess that either a NullReferenceException should be thrown (and a real fix should be made elsewhere in the code, preventing tw from being null) or no code should be emitted by EmitBox.

ghost commented 5 years ago

Hi @wessleym;

Yes. For something like this we don't have anyone available to fix this. So it's up to you if you need this.

thanks - dave

wessleym commented 5 years ago

I don't know how it should be fixed because I don't have internal knowledge of your code. I was just filing a bug report, as the message in the program requested.

markusschaber commented 5 years ago

I'm afraid currently noone has the internal knowledge. It's not "his" code, as they just adopted an orphaned project so it won't die completely, as they're users of ikvm and need it.

The original author is no longer maintaining ikvm, and as far as I can see, noone else is deep enough in the code yet. :-(

NatElkins commented 5 years ago

Maybe seek guidance from this repo https://github.com/mono/ikvm-fork ? I see it's been updated recently.

ams-tschoening commented 4 years ago

Whoever is interested in IKVM might want to have a look at a new organisation trying(!) to revive that project and collecting developer resources. It contains the latest available source code with history and already some fixes, e.g. to get things a bit more compatible with .NET Core.

https://github.com/ikvm-revived

Going to post that to the mono-fork as well, because one of the reasons starting a new organisation was that every other fork I found seemed dead as well.

NatElkins commented 4 years ago

@ams-tschoening I see there's also https://github.com/jessielesbian/ikvm . Haven't looked into it at all, I just know it exists.

ams-tschoening commented 4 years ago

@NatElkins Thanks for mentioning, I documented that fork for further discussion:

https://github.com/ikvm-revived/ikvm/issues/11

zgramana commented 4 years ago

It was relicensed to AGPL3, so that makes it a lot less interesting for many of us.

ams-tschoening commented 4 years ago

Is that relicensing even legal? It removes former copyright holders and doesn't look like the new maintainer has permissions to do so.

aaveshdev commented 3 years ago

Hi @wessleym;

Yes. For something like this we don't have anyone available to fix this. So it's up to you if you need this.

thanks - dave

I build a version that works fine. So the error was at line no. 637 of file LambdaMetafactory.cs I attached the build version. So you can use that. IKVM.zip

wessleym commented 3 years ago

@aaveshdev, that seemed to work. Would you mind making a pull request as David requested? Thank you!

aaveshdev commented 3 years ago

@wessleym Sure, I'll do that.

ams-tschoening commented 3 years ago

The mentioned fix seems to be available in ikvm-revived already, so people might want to have a look at the master there as well.