csharpfritz / csharpfritz/WebFormsTest

Issue with AreaRegistration in Global.asax

Abierto
#25 6 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement help wanted Low Priority
Lenguaje dominante
JavaScript
Estrellas
26
Forks
14
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Are areas supported?

This line:

```
AreaRegistration.RegisterAllAreas();
```

in

```
protected void Application_Start(object sender, EventArgs e
```

of

```
global.asax.cs
```

results in the error below (slightly munged).

The test is

```
[TestMethod]
public void CanIgetMasterPage()
{
var sut = WebApplicationProxy.GetPageByLocation("~/MasterPages/Main.Master") as Main;

Assert.IsNotNull(sut);

}
```

and the base test class is

namespace xxx.yyy.WebFormsTestSpike
{

```
public class WebFormsTestBase
{

protected readonly MockRepository _mockery;
protected readonly Mock contextMock;
protected readonly Mock responseMock;
protected readonly Mock requestMock;

public WebFormsTestBase()
{

_mockery = new MockRepository(MockBehavior.Loose);

contextMock = _mockery.Create();

responseMock = _mockery.Create();
contextMock.SetupGet(c => c.Response).Returns(responseMock.Object);
contextMock.SetupGet(c => c.IsDebuggingEnabled).Returns(true);

requestMock = _mockery.Create();
contextMock.SetupGet(c => c.Request).Returns(requestMock.Object);

InitializeWebApplicationProxy();
}

private void InitializeWebApplicationProxy()
{
Uri codeBase = new Uri(GetType().Assembly.CodeBase);
var currentFolder = new DirectoryInfo(Path.GetDirectoryName(codeBase.LocalPath));
var webFolder = currentFolder.Parent.Parent.Parent.GetDirectories("xxx.yyy.Web")[0];

WebApplicationProxy.Create(webFolder.FullName, true);
}
}
```

}

System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=This method cannot be called during the application's pre-start initialization phase.
Source=System.Web
StackTrace:
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Compilation.BuildManager.GetReferencedAssemblies()
at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.GetReferencedAssemblies()
at System.Web.Mvc.TypeCacheUtil.FilterTypesInAssemblies(IBuildManager buildManager, Predicate`1 predicate)
at System.Web.Mvc.TypeCacheUtil.GetFilteredTypesFromAssemblies(String cacheName, Predicate`1 predicate, IBuildManager buildManager)
at System.Web.Mvc.AreaRegistration.RegisterAllAreas(RouteCollection routes, IBuildManager buildManager, Object state)
at System.Web.Mvc.AreaRegistration.RegisterAllAreas(Object state)
at System.Web.Mvc.AreaRegistration.RegisterAllAreas()
at xxx.yyy.Web.Global.Application_Start(Object sender, EventArgs e) in C:\zzz\Repos\MarketOnce2\Products\xxx\yyy\xxx.yyy.Web\Global.asax.cs:line 117
InnerException:

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza en global.asax.cs, en Global.Application_Start, donde AreaRegistration.RegisterAllAreas() genera la excepción. Lee la prueba CanIgetMasterPage y la configuración de WebFormsTestBase.InitializeWebApplicationProxy; después, ejecuta la prueba para reproducir el fallo. Se considera terminado cuando se haya establecido si este harness admite el registro de áreas y se haya resuelto o documentado claramente el comportamiento observado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp
Área
backend, testing
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.