{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/msbuild/issues/1000","repository_url":"https://api.github.com/repos/Microsoft/msbuild","labels_url":"https://api.github.com/repos/Microsoft/msbuild/issues/1000/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/msbuild/issues/1000/comments","events_url":"https://api.github.com/repos/Microsoft/msbuild/issues/1000/events","html_url":"https://github.com/Microsoft/msbuild/issues/1000","id":175615329,"number":1000,"title":"Internal MSBuild Error: could not load type Microsoft.Build.Utilities.ToolLocationHelper","user":{"login":"natemcmaster","id":2696087,"avatar_url":"https://avatars.githubusercontent.com/u/2696087?v=3","gravatar_id":"","url":"https://api.github.com/users/natemcmaster","html_url":"https://github.com/natemcmaster","followers_url":"https://api.github.com/users/natemcmaster/followers","following_url":"https://api.github.com/users/natemcmaster/following{/other_user}","gists_url":"https://api.github.com/users/natemcmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/natemcmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemcmaster/subscriptions","organizations_url":"https://api.github.com/users/natemcmaster/orgs","repos_url":"https://api.github.com/users/natemcmaster/repos","events_url":"https://api.github.com/users/natemcmaster/events{/privacy}","received_events_url":"https://api.github.com/users/natemcmaster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-07T21:50:47Z","updated_at":"2016-09-08T15:37:47Z","closed_at":null,"body":"Encountering an error trying to parse a simple csproj using Microsoft.Build APIs\r\n\r\n> Microsoft.Build.Shared.InternalErrorException: MSB0001: Internal MSBuild Error: Type information for Microsoft.Build.Utilities.ToolLocationHelper was present in the whitelist cache as Microsoft.Build.Utilities.ToolLocationHelper, Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a but the type could not be loaded.\r\n\r\n\r\n**Repro**\r\ndotnet cli  1.0.0-preview3-003585\r\nMicrosoft.Build 0.1.0-preview-00033-160829\r\nMicrosoft.Build.Framework 0.1.0-preview-00033-160829\r\n\r\nProject\r\n```xml\r\n<Project ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" />\r\n\r\n  <PropertyGroup>\r\n    <OutputType>Exe</OutputType>\r\n    <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>\r\n    <TargetFrameworkVersion>v1.0</TargetFrameworkVersion>\r\n  </PropertyGroup>\r\n\r\n  <ItemGroup>\r\n    <Compile Include=\"**\\*.cs\" Exclude=\"$(GlobalExclude)\" />\r\n    <EmbeddedResource Include=\"**\\*.resx\" Exclude=\"$(GlobalExclude)\" />\r\n    <None Include=\"project.json\" />\r\n  </ItemGroup>\r\n\r\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\r\n</Project>\r\n```\r\n\r\nMy code:\r\n```c#\r\n            var msBuildFile = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)\r\n                ? \"MSBuild.exe\"\r\n                : \"MSBuild\";\r\n\r\n            // workaround https://github.com/Microsoft/msbuild/issues/999\r\n            Environment.SetEnvironmentVariable(\"MSBUILD_EXE_PATH\", Path.Combine(dotNetCoreSdkPath, msBuildFile));\r\n\r\n            var globalProperties = new Dictionary<string, string>\r\n            {\r\n                { \"DesignTimeBuild\", \"true\" },\r\n                { \"Configuration\", \"Debug\" },\r\n                { \"MSBuildExtensionsPath\",  dotNetCoreSdkPath },\r\n            };\r\n\r\n            var xmlReader = XmlReader.Create(csProjFileInfo.CreateReadStream());\r\n            var projectCollection = new ProjectCollection();\r\n            return new Project(xmlReader, globalProperties, /*toolsVersion: */ null, projectCollection);\r\n```\r\n\r\nStack trace:\r\n<details>\r\n```\r\n Microsoft.Build.Shared.InternalErrorException: MSB0001: Internal MSBuild Error: Type information for Microsoft.Build.Utilities.ToolLocationHelper was present in the whitelist cache as Microsoft.Build.Utilities.ToolLocationHelper, Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a but the type could not be loaded. unexpectedly null\r\n   at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args)\r\n   at Microsoft.Build.Evaluation.Expander`2.Function`1.GetTypeForStaticMethod(String typeName, String simpleMethodName)\r\n   at Microsoft.Build.Evaluation.Expander`2.Function`1.ExtractPropertyFunction(String expressionFunction, IElementLocation elementLocation, Object propertyValue, UsedUninitializedProperties usedUnInitializedProperties)\r\n   at Microsoft.Build.Evaluation.Expander`2.PropertyExpander`1.ExpandPropertyBody(String propertyBody, Object propertyValue, IPropertyProvider`1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties)\r\n   at Microsoft.Build.Evaluation.Expander`2.PropertyExpander`1.ExpandPropertiesLeaveTypedAndEscaped(String expression, IPropertyProvider`1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties)\r\n   at Microsoft.Build.Evaluation.Expander`2.PropertyExpander`1.ExpandPropertiesLeaveEscaped(String expression, IPropertyProvider`1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties)\r\n   at Microsoft.Build.Evaluation.Expander`2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.EvaluatePropertyElement(ProjectPropertyElement propertyElement)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.EvaluatePropertyGroupElement(ProjectPropertyGroupElement propertyGroupElement)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)\r\n   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()\r\n   at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation)\r\n   at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)\r\n   at Microsoft.Build.Evaluation.Project..ctor(XmlReader xmlReader, IDictionary`2 globalProperties, String toolsVersion, ProjectCollection projectCollection)\r\n```\r\n</details>"},"comment":{"url":"https://api.github.com/repos/Microsoft/msbuild/issues/comments/245639212","html_url":"https://github.com/Microsoft/msbuild/issues/1000#issuecomment-245639212","issue_url":"https://api.github.com/repos/Microsoft/msbuild/issues/1000","id":245639212,"user":{"login":"rainersigwald","id":3347530,"avatar_url":"https://avatars.githubusercontent.com/u/3347530?v=3","gravatar_id":"","url":"https://api.github.com/users/rainersigwald","html_url":"https://github.com/rainersigwald","followers_url":"https://api.github.com/users/rainersigwald/followers","following_url":"https://api.github.com/users/rainersigwald/following{/other_user}","gists_url":"https://api.github.com/users/rainersigwald/gists{/gist_id}","starred_url":"https://api.github.com/users/rainersigwald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rainersigwald/subscriptions","organizations_url":"https://api.github.com/users/rainersigwald/orgs","repos_url":"https://api.github.com/users/rainersigwald/repos","events_url":"https://api.github.com/users/rainersigwald/events{/privacy}","received_events_url":"https://api.github.com/users/rainersigwald/received_events","type":"User","site_admin":false},"created_at":"2016-09-08T15:37:47Z","updated_at":"2016-09-08T15:37:47Z","body":"@jeffkl wouldn't option 2 cause silent failures at eval time? We have a real runtime reference to that assembly, and if anything uses `ToolLocationHelper` static methods (and common targets do), that should really fail if it's not loadable."}}
{"actor":{"display_login":"rainersigwald"}}