{"action":"created","issue":{"url":"https://api.github.com/repos/Antaris/RazorEngine/issues/88","labels_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/88/comments","events_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/88/events","html_url":"https://github.com/Antaris/RazorEngine/issues/88","id":10999937,"number":88,"title":"config.Language = RazorEngine.Language.VisualBasic causes compile error BC30451","user":{"login":"isolaol","id":3594554,"avatar_url":"https://avatars.githubusercontent.com/u/3594554?v=3","gravatar_id":"","url":"https://api.github.com/users/isolaol","html_url":"https://github.com/isolaol","followers_url":"https://api.github.com/users/isolaol/followers","following_url":"https://api.github.com/users/isolaol/following{/other_user}","gists_url":"https://api.github.com/users/isolaol/gists{/gist_id}","starred_url":"https://api.github.com/users/isolaol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isolaol/subscriptions","organizations_url":"https://api.github.com/users/isolaol/orgs","repos_url":"https://api.github.com/users/isolaol/repos","events_url":"https://api.github.com/users/isolaol/events{/privacy}","received_events_url":"https://api.github.com/users/isolaol/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Antaris/RazorEngine/labels/Compilation","name":"Compilation","color":"c7def8"},{"url":"https://api.github.com/repos/Antaris/RazorEngine/labels/need-info","name":"need-info","color":"5319e7"},{"url":"https://api.github.com/repos/Antaris/RazorEngine/labels/VB.NET","name":"VB.NET","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2013-02-14T15:21:24Z","updated_at":"2015-01-23T19:04:05Z","closed_at":"2015-01-23T19:04:05Z","body":"Dear developers,\r\n\r\nAn attempt to compile template written with Razor syntax in VisualBasic.NET causes RazorEngine.Razor.Compile to throw TemplateCompilationException. The Errors collection of the exception contains an item with ErrorNumber = \"BC30451\" and ErrorText = \"'Model' is not declared. It may be inaccessible due to its protection level.\"\r\n\r\nThe code below (in VB.Net) reproduces the problem.\r\n\r\n    Public Class DataModel\r\n        Public Property AttributeX As String\r\n    End Class\r\n\r\n    Sub Main()\r\n\r\n        ' introduce variables\r\n        Dim template As String\r\n        Dim model As DataModel\r\n        Dim config As RazorEngine.Configuration.TemplateServiceConfiguration\r\n        Dim service As RazorEngine.Templating.TemplateService\r\n        Dim report As String\r\n\r\n        Try\r\n\r\n            ' set values of variables\r\n            template = \"some @Model.AttributeX here...\"\r\n            model = New DataModel()\r\n            model.AttributeX = \"content\"\r\n\r\n            ' configure templating service\r\n            config = New RazorEngine.Configuration.TemplateServiceConfiguration()\r\n            config.Language = RazorEngine.Language.VisualBasic ' set language\r\n            config.EncodedStringFactory = New RazorEngine.Text.RawStringFactory ' set output encoding\r\n            service = New RazorEngine.Templating.TemplateService(config) ' instantiate service\r\n            RazorEngine.Razor.SetTemplateService(service) ' ask engine to use configured service\r\n\r\n            ' compile template\r\n            ' !!! THIS WILL FAIL !!!\r\n            RazorEngine.Razor.Compile(Of DataModel)(template, \"default\")\r\n\r\n            ' run template\r\n            report = RazorEngine.Razor.Run(Of DataModel)(\"default\", model)\r\n            Console.WriteLine(report)\r\n\r\n        Catch exCompile As RazorEngine.Templating.TemplateCompilationException\r\n\r\n            Console.Error.WriteLine(\"ERROR: TEMPLATE COMPILATION FAILED.\")\r\n\r\n            If Not String.IsNullOrWhiteSpace(exCompile.SourceCode) Then\r\n                Console.Error.WriteLine(\"----------\")\r\n                Console.Error.WriteLine(exCompile.SourceCode)\r\n                Console.Error.WriteLine(\"----------\")\r\n            End If\r\n\r\n            For Each item As System.CodeDom.Compiler.CompilerError In exCompile.Errors\r\n                Console.Error.WriteLine(\"#{0}: {1} ({2},{3})\", item.ErrorNumber, item.ErrorText, item.Line, item.Column)\r\n            Next\r\n\r\n        End Try\r\n\r\n    End Sub\r\n\r\nI have referenced RazorEngine.dll 3.2.0.0.\r\n\r\n\r\nKind regards,\r\nOlli-Pekka Isola"},"comment":{"url":"https://api.github.com/repos/Antaris/RazorEngine/issues/comments/71246104","html_url":"https://github.com/Antaris/RazorEngine/issues/88#issuecomment-71246104","issue_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/88","id":71246104,"user":{"login":"matthid","id":1866463,"avatar_url":"https://avatars.githubusercontent.com/u/1866463?v=3","gravatar_id":"","url":"https://api.github.com/users/matthid","html_url":"https://github.com/matthid","followers_url":"https://api.github.com/users/matthid/followers","following_url":"https://api.github.com/users/matthid/following{/other_user}","gists_url":"https://api.github.com/users/matthid/gists{/gist_id}","starred_url":"https://api.github.com/users/matthid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthid/subscriptions","organizations_url":"https://api.github.com/users/matthid/orgs","repos_url":"https://api.github.com/users/matthid/repos","events_url":"https://api.github.com/users/matthid/events{/privacy}","received_events_url":"https://api.github.com/users/matthid/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T19:04:05Z","updated_at":"2015-01-23T19:04:05Z","body":"Closing this for now as 3.5.X should work (open a new issue or comment here if not)."}}