Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash while analyzing #5

Closed
sebas77 opened this issue Jan 11, 2017 · 14 comments
Closed

crash while analyzing #5

sebas77 opened this issue Jan 11, 2017 · 14 comments

Comments

@sebas77
Copy link

sebas77 commented Jan 11, 2017

Hi,

this tool is very interesting and I wanted to try on a complex project like robocraft, but after several issues reported, it crashes here:

e:\smandala-ssd-mainline\Robocraft-Unity\Assets\Scripts\Game\Utilities\TextureDebugger.cs(16)
There was an exception running the analysis
System.AggregateException: One or more errors occurred. ---> System.NullReferenc
eException: Object reference not set to an instance of an object.
at UnityEngineAnalyzer.CLI.AnalyzerReport.AppendDiagnostics(IEnumerable1 dia gnosticResults) in D:\GitHub\UnityEngineAnalyzer\UnityEngineAnalyzer.CLI\Analyze rReport.cs:line 30 at UnityEngineAnalyzer.CLI.SolutionAnalyzer.<AnalyzeProject>d__2.MoveNext() i n D:\GitHub\UnityEngineAnalyzer\UnityEngineAnalyzer.CLI\SolutionAnalyzer.cs:line 55 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot ification(Task task) at UnityEngineAnalyzer.CLI.SolutionAnalyzer.<LoadAnadAnalyzeProject>d__0.Move Next() in D:\GitHub\UnityEngineAnalyzer\UnityEngineAnalyzer.CLI\SolutionAnalyzer .cs:line 29 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeou t, CancellationToken cancellationToken) at UnityEngineAnalyzer.CLI.Program.Main(String[] args) in D:\GitHub\UnityEngi neAnalyzer\UnityEngineAnalyzer.CLI\Program.cs:line 39 ---> (Inner Exception #0) System.NullReferenceException: Object reference not se t to an instance of an object. at UnityEngineAnalyzer.CLI.AnalyzerReport.AppendDiagnostics(IEnumerable1 dia
gnosticResults) in D:\GitHub\UnityEngineAnalyzer\UnityEngineAnalyzer.CLI\Analyze
rReport.cs:line 30
at UnityEngineAnalyzer.CLI.SolutionAnalyzer.d__2.MoveNext() i
n D:\GitHub\UnityEngineAnalyzer\UnityEngineAnalyzer.CLI\SolutionAnalyzer.cs:line
55
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task)
at UnityEngineAnalyzer.CLI.SolutionAnalyzer.d__0.Move
Next() in D:\GitHub\UnityEngineAnalyzer\UnityEngineAnalyzer.CLI\SolutionAnalyzer
.cs:line 29<---

@vad710
Copy link
Owner

vad710 commented Jan 11, 2017

Thanks for writing this up! I will look into it and follow up.

vad710 added a commit that referenced this issue Jan 11, 2017
@vad710
Copy link
Owner

vad710 commented Jan 16, 2017

Hi @sebas77

I was not able to reproduce your issue - but I think I might have of found the cause of it. I have created a new build - if you have the chance, could you please let me know how it works out for you? https://github.com/vad710/UnityEngineAnalyzer/releases/tag/alpha-04

Thanks in advance!

Vinny

@sebas77
Copy link
Author

sebas77 commented Jan 16, 2017 via email

@sebas77
Copy link
Author

sebas77 commented Jan 17, 2017

still happening. I dumped the output, but I don't think it will help.

result.txt

BTW, I am pretty sure that sealing classes/methods will not improve performance. I did research on it, since I had the same feeling (sealing should improve the vtable performance right?), but it's just a urban legend. I don't remember right now why, but I can research again if you think I am wrong.

did some quick research. Most of the time c# uses callvirt even if you don't expect so, to make the code safer. Only in some specific cases call is used, like on struct.

@vad710
Copy link
Owner

vad710 commented Jan 17, 2017

Hey @sebas77 !

Thanks for the feedback! The sealed class analyzer was created based on this article: https://blogs.unity3d.com/2016/07/26/il2cpp-optimizations-devirtualization/ - I have not done any research on this personally. This case is pretty specific to il2cpp - which is why at some point I'd like to make the analyzers react to the target platform.

I'll take a look at the output and see if I can either get to the bottom of it, or allow it to continue when this sort of error occurs.

Thanks again for the feedback! I am a big fan of your work and often run into it when researching performance on Unity.

@sebas77
Copy link
Author

sebas77 commented Jan 17, 2017

this project is surely useful for standalone games as well. Once the bug will be fixed, I hope I can add more tests myself.

@vad710
Copy link
Owner

vad710 commented Jan 17, 2017

Taking a look at the exception, it looks like I introduced a new exception in the previous build. I will try to get this fixed this evening when I get home from work.

@vad710
Copy link
Owner

vad710 commented Jan 17, 2017

I fixed the issue I introduced as well as tightened the original fix a bit. Please let me know if this works out for you: https://github.com/vad710/UnityEngineAnalyzer/releases/tag/alpha-05

@sebas77
Copy link
Author

sebas77 commented Jan 18, 2017

Hey, it worked! I have just two minor weirdness now. This message in the log:
AD0001 Warning Analyzer 'UnityEngineAnalyzer.StringMethods.DoNotUseStringMethod
sAnalyzer' threw an exception of type 'System.ArgumentException' with message 'U
nable to determine name of method'. 0,0
and the file UnityReport.html is empty, while report.json is ok.

@vad710
Copy link
Owner

vad710 commented Jan 18, 2017

Awesome!

Because the HTML file loads the json dynamically, some browsers have issues with Cross-Origin Request. If you open the HTML file in Firefox it should load. I am not exactly sure how to work around this yet. I might just create an HTML exporter and have the data embedded in the HTML.

I am not sure why you received that error on the DoNotUseStringMethod analyzer - this is one of the Analyzers that I moved to "Information" category and generally don't report it as it does not impact performance. Nevertheless, I will look into it. I will keep this issue open until I get more insight into your new problem.

Thanks again for helping through this issue - I hope you found the report to be helpful.

@sebas77
Copy link
Author

sebas77 commented Jan 18, 2017

Yes I am sure it will be helpful and I really hope I can add more tests...let me know if you have plans to make it platform dependent.

@vad710
Copy link
Owner

vad710 commented Jan 18, 2017

I have a local branch where I am converting the tooling to work on dotnet core - Because of some bugs in the dotnet core tooling (dotnet/sdk#527) it's been on hold.

I am also working on a plugin for Unity.

Please let me know if you need a hand making any new analyzers.

@vad710 vad710 closed this as completed Jan 23, 2017
@wpinaud
Copy link

wpinaud commented Mar 3, 2017

@vad710 I just saw that you are working on a plugin for Unity, that sound amazing.
Is it a project open for collaboration?
Also, do you have already an idea about the release date?

@vad710
Copy link
Owner

vad710 commented Mar 4, 2017

Hi @wpinaud ! Thanks for your interest in the project!

I've been working with some folks from Microsoft to get a Mac build of the analyzer and this has been my top priority - as this has been the most requested feature when I show the Analyzer at meetups and other developer events.

I do not have a date for the plugin and I have not opened it for collaboration yet. If you have specific feature requests for either the plugin or the analyzer, I encourage you to create an issue.

thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants