System.NullReferenceException during building Autofac project
marxin opened this issue · 2 comments
Hello.
First of all, I really appreciate that you've been working on that!
I've been trying to build Autofac solution with your addin:
https://github.com/autofac/Autofac.git
When I trigger build from MonoDevelop, I do not see much informative message:
Build failed. Value cannot be null.
Parameter name: key
Build: 1 error, 0 warnings
However when I run:
$ mdtool build src/Autofac/Autofac.xproj
FATAL ERROR [2015-12-10 09:04:55Z]: System.NullReferenceException: Object reference not set to an instance of an object
at MonoDevelop.Dnx.DnxProjectService.GetDiagnostics (MonoDevelop.Dnx.DnxProjectBuilder builder) <0x407ccde0 + 0x000c7> in :0
at MonoDevelop.Dnx.DnxProjectBuilder.Build () <0x407cccc0 + 0x00027> in :0
at MonoDevelop.Dnx.DnxProject.OnRunTarget (IProgressMonitor monitor, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc800 + 0x00087> in :0
at MonoDevelop.Projects.DefaultProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc630 + 0x00126> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc5e0 + 0x00046> in :0
at MonoDevelop.Projects.CustomCommandExtension.Build (IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem entry, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc260 + 0x0012b> in :0
at MonoDevelop.Projects.ProjectServiceExtension.Build (IProgressMonitor monitor, IBuildTarget item, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cc0a0 + 0x000ae> in :0
at MonoDevelop.Projects.ProjectServiceExtension.RunTarget (IProgressMonitor monitor, IBuildTarget item, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbfb0 + 0x00062> in :0
at MonoDevelop.Projects.SolutionItem.RunTarget (IProgressMonitor monitor, System.String target, MonoDevelop.Projects.ConfigurationSelector configuration) <0x407cbf50 + 0x0004d> in :0
at MonoDevelop.Projects.BuildTool.Run (System.String[] arguments) <0x40771fa0 + 0x008ed> in :0
at MonoDevelopProcessHost.Main (System.String[] args) <0x406c9d50 + 0x00745> in :0
The problem is that 'projectSystem' == null in MonoDevelop.Dnx.DnxProjectService.GetDiagnostics.
Thanks,
Martin
What would the expected output be when using mdtool with a DNX project? A .nupkg or a set of AutoFac assemblies? Presumably it should produce the same output as when dnu is run?
The projectSystem will be null since that is currently only created when the project is opened inside Xamarin Studio.
Currently the addin does not support building, even inside Xamarin Studio, to generate assemblies. The build currently just asks the DNX host for diagnostic information so Xamarin Studio can show warnings and errors.
I have split out the second mdtool problem into a separate issue #6
I believe the first problem is due to a missing DNX runtime. The error is obscured since things are not setup so the addin is trying to use the DNX host which is not initialized.I have added extra error handling for this. Errors will now be displayed in the Dependencies folder. Also when you build you will get a more useful error message.
Currently the addin will not download the DNX runtime for you. So you will have to download and install it separately.
I also had a problem with the file watcher with the AutoFac solution: kqueue() FileSystemWatcher has reached the maximum number of files to watch.
which maybe fixed in a more recent version of Mono, but is not in Mono 4.2.1. So I had to set the environment variable and run MonoDevelop from the command line.
export MONO_MANAGED_WATCHER=false