{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/1759","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/1759/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/1759/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/1759/events","html_url":"https://github.com/dotnet/roslyn/issues/1759","id":66016484,"number":1759,"title":"Exceptions thrown from within custom LocalizableString implementation used in analyzer not resulting in info diagnostic during command line builds","user":{"login":"shyamnamboodiripad","id":10579684,"avatar_url":"https://avatars.githubusercontent.com/u/10579684?v=3","gravatar_id":"","url":"https://api.github.com/users/shyamnamboodiripad","html_url":"https://github.com/shyamnamboodiripad","followers_url":"https://api.github.com/users/shyamnamboodiripad/followers","following_url":"https://api.github.com/users/shyamnamboodiripad/following{/other_user}","gists_url":"https://api.github.com/users/shyamnamboodiripad/gists{/gist_id}","starred_url":"https://api.github.com/users/shyamnamboodiripad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shyamnamboodiripad/subscriptions","organizations_url":"https://api.github.com/users/shyamnamboodiripad/orgs","repos_url":"https://api.github.com/users/shyamnamboodiripad/repos","events_url":"https://api.github.com/users/shyamnamboodiripad/events{/privacy}","received_events_url":"https://api.github.com/users/shyamnamboodiripad/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Analyzers","name":"Area-Analyzers","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Bug","name":"Bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"mavasani","id":10605811,"avatar_url":"https://avatars.githubusercontent.com/u/10605811?v=3","gravatar_id":"","url":"https://api.github.com/users/mavasani","html_url":"https://github.com/mavasani","followers_url":"https://api.github.com/users/mavasani/followers","following_url":"https://api.github.com/users/mavasani/following{/other_user}","gists_url":"https://api.github.com/users/mavasani/gists{/gist_id}","starred_url":"https://api.github.com/users/mavasani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavasani/subscriptions","organizations_url":"https://api.github.com/users/mavasani/orgs","repos_url":"https://api.github.com/users/mavasani/repos","events_url":"https://api.github.com/users/mavasani/events{/privacy}","received_events_url":"https://api.github.com/users/mavasani/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/1","html_url":"https://github.com/dotnet/roslyn/milestones/1.0%20(stable)","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/1/labels","id":937397,"number":1,"title":"1.0 (stable)","description":"This is our 1.0 Milestone. ","creator":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"open_issues":227,"closed_issues":176,"state":"open","created_at":"2015-01-15T20:45:24Z","updated_at":"2015-04-20T21:29:06Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-04-02T21:39:30Z","updated_at":"2015-04-20T21:29:06Z","closed_at":"2015-04-20T21:29:06Z","body":"1. Create an analyzer using template\r\n2. Create a custom derived type of LocalizableString that throws an exception from within its GetText() method.\r\n3. Replace the initializer for MessageFormat in the analyzer with code to instantiate the type created in 2 above ```internal static readonly LocalizableString MessageFormat = new MyLocalizableString(); ```\r\n4. Create a console app and add the above analyzer as a nuget analyzer reference\r\n5. Open this console app - notice that the exception from 2 above results in an info diagnostic in the error list\r\n6. Now change build output verbosity for VS to detailed as described in the resolution for #1508 (so that info diagnostic for the above exception is displayed in the command line build output)\r\n7. Build the solution\r\n\r\nExpected: Info diagnostic for exception is displayed in the build output\r\nActual: No info diagnostic for above exception in build output\r\n\r\nPer discussion with @mavasani, the bug may be that - *We never hook up exception handler for exceptions within localizable string in command line case. We do so for other exceptions from analyzers during explicit callbacks (such as from within Initialize(), Analyze...() etc.).*\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/94573789","html_url":"https://github.com/dotnet/roslyn/issues/1759#issuecomment-94573789","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/1759","id":94573789,"user":{"login":"mavasani","id":10605811,"avatar_url":"https://avatars.githubusercontent.com/u/10605811?v=3","gravatar_id":"","url":"https://api.github.com/users/mavasani","html_url":"https://github.com/mavasani","followers_url":"https://api.github.com/users/mavasani/followers","following_url":"https://api.github.com/users/mavasani/following{/other_user}","gists_url":"https://api.github.com/users/mavasani/gists{/gist_id}","starred_url":"https://api.github.com/users/mavasani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavasani/subscriptions","organizations_url":"https://api.github.com/users/mavasani/orgs","repos_url":"https://api.github.com/users/mavasani/repos","events_url":"https://api.github.com/users/mavasani/events{/privacy}","received_events_url":"https://api.github.com/users/mavasani/received_events","type":"User","site_admin":false},"created_at":"2015-04-20T21:29:06Z","updated_at":"2015-04-20T21:29:06Z","body":"@shyamnamboodiripad I am unable to repro this, i.e. I do the see the info diagnostic in output window after changing msbuild verbosity to detailed.\r\n\r\nCan you please verify if it still repros for you? \r\n\r\nAlso make sure that you don't receive the warning about \"no analyzers present\" in the build output. Common scenario where an analyzer diagnostic shows up in error list but not command line is build is if the toolset compiler has a different version Microsoft.CodeAnalysis then the one referenced by the analyzer.\r\n\r\nMy analyzer uses the below custom LocalizableString implementation:\r\n```\r\npublic class MyLocString : LocalizableString\r\n    {\r\n        protected override bool AreEqual(object other)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        protected override int GetHash()\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n\r\n        protected override string GetText(IFormatProvider formatProvider)\r\n        {\r\n            throw new NotImplementedException();\r\n        }\r\n    }\r\n```\r\n\r\nI see the below in error list:\r\n```\r\nSeverity\tCode\tDescription\tProject\tFile\tLine\r\nMessage\tAD0001\tThe User Diagnostic Analyzer 'Analyzer1.Analyzer1Analyzer' threw an exception of type 'System.NotImplementedException' with message 'The method or operation is not implemented.'.\tClassLibrary2\t\t1\r\n\r\n```\r\nI see the below in the output window:\r\n```\r\n1>  C:\\Program Files (x86)\\MSBuild\\14.0\\bin\\csc2.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /errorendlocation /preferreduilang:en-US /highentropyva+ /reference:\"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5.2\\Microsoft.CSharp.dll\" /reference:\"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5.2\\mscorlib.dll\" /reference:\"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5.2\\System.Core.dll\" /reference:\"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5.2\\System.Data.DataSetExtensions.dll\" /reference:\"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5.2\\System.Data.dll\" /reference:\"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5.2\\System.dll\" /reference:\"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5.2\\System.Net.Http.dll\" /reference:\"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5.2\\System.Xml.dll\" /reference:\"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5.2\\System.Xml.Linq.dll\" /debug+ /debug:full /filealign:512 /optimize- /out:obj\\Debug\\ClassLibrary2.dll /ruleset:\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Team Tools\\Static Analysis Tools\\\\Rule Sets\\MinimumRecommendedRules.ruleset\" /subsystemversion:6.00 /target:library /utf8output /analyzer:..\\ClassLibrary1\\bin\\Debug\\ClassLibrary1.dll Class1.cs Properties\\AssemblyInfo.cs \"C:\\Users\\mavasani\\AppData\\Local\\Temp\\.NETFramework,Version=v4.5.2.AssemblyAttributes.cs\" obj\\Debug\\\\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs obj\\Debug\\\\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs obj\\Debug\\\\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs\r\n1>  Microsoft (R) Visual C# Compiler version 1.0.0.50420\r\n1>  Copyright (C) Microsoft Corporation. All rights reserved.\r\n1>  info AD0001: The Compiler Analyzer 'Analyzer1.Analyzer1Analyzer' threw an exception of type 'System.NotImplementedException' with message 'The method or operation is not implemented.'.\r\n```"}}