diff --git a/src/IKVM.ByteCode.Tests/Decoding/CodeDecoderTests.cs b/src/IKVM.ByteCode.Tests/Decoding/CodeDecoderTests.cs index b2ff60b..8d19644 100644 --- a/src/IKVM.ByteCode.Tests/Decoding/CodeDecoderTests.cs +++ b/src/IKVM.ByteCode.Tests/Decoding/CodeDecoderTests.cs @@ -158,7 +158,7 @@ public void CanCopyToWithConstant() ]); var buffer1 = new BlobBuilder(); - new CodeBuilder(buffer1).LoadConstant(new StringConstantHandle(1)).Pop().Return(); + new CodeBuilder(buffer1).LoadConstant(new IntegerConstantHandle(1)).Pop().Return(); var code1 = new CodeDecoder(buffer1.ToArray()); // copy from decoder into new builder diff --git a/src/IKVM.ByteCode/Decoding/CodeAttribute.cs b/src/IKVM.ByteCode/Decoding/CodeAttribute.cs index ae9492e..9c17ea5 100644 --- a/src/IKVM.ByteCode/Decoding/CodeAttribute.cs +++ b/src/IKVM.ByteCode/Decoding/CodeAttribute.cs @@ -70,7 +70,6 @@ public readonly void CopyTo(TConstantView constant where TConstantPool : IConstantPool { // copy code to new blob - var codeOffset = (int)Code.Length; var code = new BlobBuilder((int)Code.Length); new CodeDecoder(Code).CopyTo(constantView, constantPool, new CodeBuilder(code)); @@ -80,7 +79,7 @@ public readonly void CopyTo(TConstantView constant // add code attribute with copied values var excp = ExceptionTable; - encoder.Code(constantPool.Get(AttributeName.Code), MaxStack, MaxLocals, code, e => excp.CopyTo(constantView, constantPool, ref e, codeOffset), attr); + encoder.Code(constantPool.Get(AttributeName.Code), MaxStack, MaxLocals, code, e => excp.CopyTo(constantView, constantPool, ref e, 0), attr); } }