0

BC30203: Identifier expectedASP.NETMVC4プロジェクトでエラーが発生します。なぜこれが起こっているのか私にはまったくわかりません、そして私は非常にイライラしています。エラーがどこにあるのかわかりません(クラス以外)。

何日もページに触れていなかったので(前回は機能していました)、エラーが発生しました。一時ファイルをクリアすると、.NET Frameworkの一時ファイルも役に立ちません。再起動して、VSを再インストールします。運が悪かったので、2010RCから2012RCに切り替えました。私は完全に途方に暮れています。

私はますます多くのコードを削除しました、そしてそれは私が変数を宣言するときはいつでも起こるようです。この1ページではなく、100%動作するので、私のモデルやその他のものではありません。

部分ビューのコードは次のとおりです。

@ModelType Frontend.Models.Collection 

@Code
    ViewData("Title") = "GetFilters"
End Code

@AddSeparator("Options")
@Options

@Helper Options()   

    Dim less As String=String.Empty
    @<div class="ui-splitbutton filter">
        <a class="@less" href="#" title="Show only basic filters" rel="nofollow">Show less</a>
        <a class="" href="#" title="Show all available filters" rel="nofollow">Show more</a> 
    </div>

    @<div>
        <a class="button clear_filters filter" href="#" title="Remove all applied filters" rel="nofollow">Clear filters</a>
     </div>

End Helper

@Helper AddSeparator(text As String)                                               
    @<div class="separator">
        <span>@text</span>
    </div>
End Helper

ページをレンダリングする方法は次のとおりです。

@Code
    Html.RenderPartial("_PartialFilters", Model)
End code

そしてここに例外があります:

System.Web.HttpCompileException was unhandled by user code
  ErrorCode=-2147467259
  HResult=-2147467259
  Message=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\3a7646ef\5efed268\App_Web__partialfilters.vbhtml.34d3db15.w7n2unx9.0.vb(60): error BC30203: Identifier expected.
  Source=System.Web
  SourceCode=#ExternalChecksum("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml","{ff1816ec-aa5e-4d10-87f7-6f4963833460}","EE63B19A6BCF554D9625D51B8F673B27C85CCC09")
'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:4.0.30319.17626
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Net
Imports System.Web
Imports System.Web.Helpers
Imports System.Web.Mvc
Imports System.Web.Mvc.Ajax
Imports System.Web.Mvc.Html
Imports System.Web.Routing
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.WebPages

Namespace ASP

    Public Class _Page_Views_Browse__PartialFilters_vbhtml
        Inherits System.Web.Mvc.WebViewPage(Of Frontend.Models.Collection)


#ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml", 10)
Public Function Options() As System.Web.WebPages.HelperResult

#End ExternalSource
Return New System.Web.WebPages.HelperResult(Sub (__razor_helper_writer)

#ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml", 10)


    Dim less As String=String.Empty

#End ExternalSource
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 202, 4, true)
WriteLiteralTo(__razor_helper_writer, "    ")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 202, 4, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 207, 4, true)
WriteLiteralTo(__razor_helper_writer, "<div")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 207, 4, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 211, 30, true)
WriteLiteralTo(__razor_helper_writer, " class=""ui-splitbutton filter""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 211, 30, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 241, 13, true)
WriteLiteralTo(__razor_helper_writer, ">"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"        <a")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 241, 13, true)
WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=""", 254), Tuple.Create("""", 267) _, Tuple.Create(Tuple.Create("", 262), Tuple.Create(Of System.Object, System.Int32)(less _, 262), False) _)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 268, 9, true)
WriteLiteralTo(__razor_helper_writer, " href=""#""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 268, 9, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 277, 32, true)
WriteLiteralTo(__razor_helper_writer, " title=""Show only basic filters""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 277, 32, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 309, 15, true)
WriteLiteralTo(__razor_helper_writer, " rel=""nofollow""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 309, 15, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 324, 26, true)
WriteLiteralTo(__razor_helper_writer, ">Show less</a>"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"        <a")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 324, 26, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 350, 9, true)
WriteLiteralTo(__razor_helper_writer, " class=""""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 350, 9, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 359, 9, true)
WriteLiteralTo(__razor_helper_writer, " href=""#""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 359, 9, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 368, 35, true)
WriteLiteralTo(__razor_helper_writer, " title=""Show all available filters""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 368, 35, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 403, 15, true)
WriteLiteralTo(__razor_helper_writer, " rel=""nofollow""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 403, 15, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 418, 29, true)
WriteLiteralTo(__razor_helper_writer, ">Show more</a> "&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"    </div>"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 418, 29, true)

#ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml", 17)


#End ExternalSource
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 449, 4, true)
WriteLiteralTo(__razor_helper_writer, "    ")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 449, 4, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 454, 17, true)
WriteLiteralTo(__razor_helper_writer, "<div>"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"        <a")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 454, 17, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 471, 36, true)
WriteLiteralTo(__razor_helper_writer, " class=""button clear_filters filter""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 471, 36, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 507, 9, true)
WriteLiteralTo(__razor_helper_writer, " href=""#""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 507, 9, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 516, 35, true)
WriteLiteralTo(__razor_helper_writer, " title=""Remove all applied filters""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 516, 35, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 551, 15, true)
WriteLiteralTo(__razor_helper_writer, " rel=""nofollow""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 551, 15, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 566, 33, true)
WriteLiteralTo(__razor_helper_writer, ">Clear filters</a>"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"     </div>"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 566, 33, true)

#ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml", 21)


#End ExternalSource
End Sub)
End Function


#ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml", 24)
Public Function AddSeparator(text As String) As System.Web.WebPages.HelperResult

#End ExternalSource
Return New System.Web.WebPages.HelperResult(Sub (__razor_helper_writer)

#ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml", 24)


#End ExternalSource
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 727, 4, true)
WriteLiteralTo(__razor_helper_writer, "    ")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 727, 4, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 732, 4, true)
WriteLiteralTo(__razor_helper_writer, "<div")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 732, 4, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 736, 18, true)
WriteLiteralTo(__razor_helper_writer, " class=""separator""")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 736, 18, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 754, 17, true)
WriteLiteralTo(__razor_helper_writer, ">"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"        <span>")
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 754, 17, true)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 772, 4, false)

#ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml", 26)
WriteTo(__razor_helper_writer, text)

#End ExternalSource
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 772, 4, false)
BeginContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 776, 21, true)
WriteLiteralTo(__razor_helper_writer, "</span>"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"    </div>"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))
EndContext(__razor_helper_writer, "~/Views/Browse/_PartialFilters.vbhtml", 776, 21, true)

#ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml", 28)

#End ExternalSource
End Sub)
End Function


        Public Sub New()
            MyBase.New
        End Sub

        Protected ReadOnly Property ApplicationInstance() As ASP.global_asax
            Get
                Return CType(Context.ApplicationInstance,ASP.global_asax)
            End Get
        End Property

        Public Overrides Sub Execute()
BeginContext("~/Views/Browse/_PartialFilters.vbhtml", 40, 2, true)

WriteLiteral(""&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))

EndContext("~/Views/Browse/_PartialFilters.vbhtml", 40, 2, true)


            #ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml",3)

    ViewData("Title") = "GetFilters"


            #End ExternalSource
BeginContext("~/Views/Browse/_PartialFilters.vbhtml", 95, 4, true)

WriteLiteral(""&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))

EndContext("~/Views/Browse/_PartialFilters.vbhtml", 95, 4, true)

BeginContext("~/Views/Browse/_PartialFilters.vbhtml", 100, 23, false)


            #ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml",7)
Write(AddSeparator("Options"))


            #End ExternalSource
EndContext("~/Views/Browse/_PartialFilters.vbhtml", 100, 23, false)

BeginContext("~/Views/Browse/_PartialFilters.vbhtml", 123, 2, true)

WriteLiteral(""&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))

EndContext("~/Views/Browse/_PartialFilters.vbhtml", 123, 2, true)

BeginContext("~/Views/Browse/_PartialFilters.vbhtml", 126, 7, false)


            #ExternalSource("C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\_PartialFilters.vbhtml",8)
Write(Options)


            #End ExternalSource
EndContext("~/Views/Browse/_PartialFilters.vbhtml", 126, 7, false)

BeginContext("~/Views/Browse/_PartialFilters.vbhtml", 133, 4, true)

WriteLiteral(""&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))

EndContext("~/Views/Browse/_PartialFilters.vbhtml", 133, 4, true)

BeginContext("~/Views/Browse/_PartialFilters.vbhtml", 638, 4, true)

WriteLiteral(""&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))

EndContext("~/Views/Browse/_PartialFilters.vbhtml", 638, 4, true)

        End Sub
    End Class
End Namespace

  WebEventCode=0
  StackTrace:
       at System.Web.Compilation.AssemblyBuilder.Compile()
       at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
       at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
       at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
       at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
       at System.Web.Compilation.BuildManager.GetObjectFactory(String virtualPath, Boolean throwIfNotFound)
       at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(String virtualPath)
       at System.Web.Mvc.BuildManagerViewEngine.FileExists(ControllerContext controllerContext, String virtualPath)
       at System.Web.Mvc.VirtualPathProviderViewEngine.<>c__DisplayClass4.<GetPathFromGeneralName>b__0(String path)
       at System.Web.WebPages.DefaultDisplayMode.GetDisplayInfo(HttpContextBase httpContext, String virtualPath, Func`2 virtualPathExists)
       at System.Web.WebPages.DisplayModeProvider.<>c__DisplayClassb.<GetDisplayInfoForVirtualPath>b__8(IDisplayMode mode)
       at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
       at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
       at System.Web.WebPages.DisplayModeProvider.GetDisplayInfoForVirtualPath(String virtualPath, HttpContextBase httpContext, Func`2 virtualPathExists, IDisplayMode currentDisplayMode, Boolean requireConsistentDisplayMode)
       at System.Web.WebPages.DisplayModeProvider.GetDisplayInfoForVirtualPath(String virtualPath, HttpContextBase httpContext, Func`2 virtualPathExists, IDisplayMode currentDisplayMode)
       at System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext, List`1 locations, String name, String controllerName, String areaName, String cacheKey, String[]& searchedLocations)
       at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations)
       at System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView(ControllerContext controllerContext, String partialViewName, Boolean useCache)
       at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClass8.<FindPartialView>b__7(IViewEngine e)
       at System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths)
       at System.Web.Mvc.ViewEngineCollection.Find(Func`2 cacheLocator, Func`2 locator)
       at System.Web.Mvc.ViewEngineCollection.FindPartialView(ControllerContext controllerContext, String partialViewName)
       at System.Web.Mvc.HtmlHelper.FindPartialView(ViewContext viewContext, String partialViewName, ViewEngineCollection viewEngineCollection)
       at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
       at System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper htmlHelper, String partialViewName, Object model)
       at ASP._Page_Views_Browse_Index_vbhtml.Execute() in C:\Users\Amy Pond\Documents\ilovetv\Code\Store\Frontend\Views\Browse\Index.vbhtml:line 16
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
       at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
  InnerException: 
4

2 に答える 2

2

サイトマスターが欲しくなかったので、この行のない単純なページを作成したときにも同じ問題が発生しました。入れたら大丈夫でした。

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
于 2012-08-02T05:44:06.483 に答える
0

これが起こり、修正できない他の人のために...

私の場合、部分的なページ内に、多くのドロップダウンやその他のコントロールを作成していました。このためのヘルパーを作成し、コードの大部分を@Functionヘルパーに移動してTagBuilderを使用しました。

安価な回避策ではないと思います-多すぎます。根本的な原因はまだわかりません。

于 2012-07-26T05:07:56.460 に答える