Git Product home page Git Product logo

Comments (16)

chexiongsheng avatar chexiongsheng commented on September 3, 2024

能定位到具体是哪个类注入报错么?

from injectfix.

Laughing111 avatar Laughing111 commented on September 3, 2024

OK

from injectfix.

Laughing111 avatar Laughing111 commented on September 3, 2024

等我哦

from injectfix.

Laughing111 avatar Laughing111 commented on September 3, 2024

是一个添加了partial关键字的类

from injectfix.

Laughing111 avatar Laughing111 commented on September 3, 2024

看报错信息里,定位到是Code.Translator.cs中的这句报空指针 ,请问会是什么原因呢

if (md.Body != null && !checkILAndGetOffset(md, md.Body.Instructions)) //if条件中报空指针 { //Console.WriteLine("check " + md + " fail il = " + md.Body.Instructions[p] // + ",caller=" + method); return false; }

from injectfix.

chexiongsheng avatar chexiongsheng commented on September 3, 2024

partial的类我以前是试过的

from injectfix.

chexiongsheng avatar chexiongsheng commented on September 3, 2024

最好能贴个必现的例子

from injectfix.

Laughing111 avatar Laughing111 commented on September 3, 2024

您好,这个例子是必现的哈,我指定配置这个类,进行注入时就会报错

from injectfix.

Laughing111 avatar Laughing111 commented on September 3, 2024

项目原因不方便贴上来呢,我先排查排查,然后在这里继续comment,请教您哈

from injectfix.

Laughing111 avatar Laughing111 commented on September 3, 2024

不过您能说说一般符合什么情况的类,会被提示注入空指针呢

from injectfix.

chexiongsheng avatar chexiongsheng commented on September 3, 2024

报错的地方准确的话应该是md为空。
简单加个判断是可以避免这个异常,但是需要知道具体情况才能更准确的处理

from injectfix.

lucisalee avatar lucisalee commented on September 3, 2024

我也碰到了类似的问题,最简化代码如下,当注入class A的时候将会报错

namespace NSA { class A :NSB.B { public void test() { base.ba(() => { base.bb(1); }); } } } namespace NSB { public class B { public virtual void ba( Action onComplete) { } public virtual void bb<T>( T data) { } } }

from injectfix.

chexiongsheng avatar chexiongsheng commented on September 3, 2024

我也碰到了类似的问题,最简化代码如下,当注入class A的时候将会报错

namespace NSA { class A :NSB.B { public void test() { base.ba(() => { base.bb(1); }); } } } namespace NSB { public class B { public virtual void ba( Action onComplete) { } public virtual void bb<T>( T data) { } } }

同样的代码我在unity5.2.3测试没问题
你是啥版本?

from injectfix.

Laughing111 avatar Laughing111 commented on September 3, 2024

截图

报错定位是这里
Object reference not set to an instance of an object
at IFix.CodeTranslator.checkILAndGetOffset (Mono.Cecil.MethodDefinition method, Mono.Collections.Generic.Collection1[T] instructions, System.Collections.Generic.Dictionary2[TKey,TValue] ilOffset, System.Int32& stopPos) [0x0033c] in

再下探查找,应该是bool ret = checkILAndGetOffset(method, instructions, null, out p); 这里的空指针

from injectfix.

chexiongsheng avatar chexiongsheng commented on September 3, 2024

但问题是我同样的代码,并不会报错,unity5.2.3和unity2018都试过了,都不报错

from injectfix.

chexiongsheng avatar chexiongsheng commented on September 3, 2024

这是unity 2018(或者更新版本)设置.net 3.5独有的问题。更新下代码,并重新编译

from injectfix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.