Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppDomain.CreateDomain cannot dynamically load test assembly #419

Closed
NTaylorMullen opened this issue Jan 31, 2017 · 3 comments
Closed

AppDomain.CreateDomain cannot dynamically load test assembly #419

NTaylorMullen opened this issue Jan 31, 2017 · 3 comments
Assignees
Labels

Comments

@NTaylorMullen
Copy link
Member

Description

Creating an app domain and then having it perform a callback that requires the test assembly to be loaded results in a load failure. This used to work in project.json land.

Steps to reproduce

  • git clone git@github.com:aspnet/Mvc.git
  • cd Mvc
  • git fetch
  • git checkout nimullen/migration.createdomain
  • cd test/Microsoft.AspNetCore.Mvc.Core.Test
  • dotnet restore
  • dotnet test -f net451 --filter "FullyQualifiedName=Microsoft.AspNetCore.Mvc.Infrastructure.ActionContextAccessorTests.ChangingAppDomainsDoesNotBreak_ActionContextAccessor"

Expected behavior

Test Passes

Actual behavior

Test fails

Environment

.NET Command Line Tools (1.0.0-rc4-004616)

Product Information:
 Version:            1.0.0-rc4-004616
 Commit SHA-1 hash:  56d8071361

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Users\nimullen\AppData\Local\Microsoft\dotnet\sdk\1.0.0-rc4-004616
@natemcmaster
Copy link
Contributor

This might be a duplicate of #311. I've generally found that errors with AppComain.CreateDomain are solved by using the overload that accepts AppDomainSetup as:

var setupInfo = new AppDomainSetup
{
   ApplicationBase = AppDomain.CurrentDomain.BaseDirectory
};
var newDomain = AppDomain.CreateDomain("new", null, setupInfo);

dougbu added a commit to aspnet/Mvc that referenced this issue Feb 23, 2017
…s from dev

- manually recreate *.sln files to correct VS versions and use old project GUIDs
  - add missing lines to the .sln files; build configuration likely not used before
- manually migrate RazorPagesWebSite project
- remove `ToolsVersion` attributes
- add repo.props file; never test TestCommon project and only build Mvc.sln
- add dependencies.props file to match other repos

Test-related:
- add `$(PreserveCompilationContext)` to test projects that examine their own dependencies
- remove comments from xunit.runner.json files; xUnit does not support them
- remove .notest files
- work around inability to deserialize a odd `ref` type
  - xUnit and vstest now serialize / deserialze test data more often
- work around microsoft/vstest#419 instead of skipping test
- enable testes that hit microsoft/vstest#427; bug has been fixed
- add `<Service>`s to test projects
dougbu added a commit to aspnet/Mvc that referenced this issue Feb 26, 2017
…s from dev

- manually recreate *.sln files to correct VS versions and use old project GUIDs
  - add missing lines to the .sln files; build configuration likely not used before
- manually migrate RazorPagesWebSite project
- remove `ToolsVersion` attributes
- add repo.props file; never test TestCommon project and only build Mvc.sln
- add dependencies.props file to match other repos

Test-related:
- add `$(PreserveCompilationContext)` to test projects that examine their own dependencies
- remove comments from xunit.runner.json files; xUnit does not support them
- remove .notest files
- work around inability to deserialize a odd `ref` type
  - xUnit and vstest now serialize / deserialze test data more often
- work around microsoft/vstest#419 instead of skipping test
- enable testes that hit microsoft/vstest#427; bug has been fixed
- add `<Service>`s to test projects
dougbu added a commit to aspnet/Mvc that referenced this issue Feb 27, 2017
…s from dev

- manually recreate *.sln files to correct VS versions and use old project GUIDs
  - add missing lines to the .sln files; build configuration likely not used before
- manually migrate RazorPagesWebSite project
- remove `ToolsVersion` attributes
- add repo.props file; never test TestCommon project and only build Mvc.sln
- remove aspnet/KoreBuild#182 workaround; bug fixed
- remove `Microsoft.DotNet.InternalAbstractions` and `System.Xml.XmlDocument` dependencies
- stop floating `$(CoreFxVersion)` and `Microsoft.Extensions.DependencyModel` dependencies
- add dependencies.props file to match other repos

Test-related:
- re-enable .NET Framework run of the functional tests
  - disable shadow copying
- make Microsoft.AspNetCore.Mvc.TestDiagnosticListener a regular class library
- add support for `/p:GenerateBaselines=true` for functional and Razor.Host tests
- add `$(PreserveCompilationContext)` to test projects that examine their own dependencies
- remove `$(RuntimeIdentifier)` settings
- remove comments from xunit.runner.json files; xUnit does not support them
- remove .notest files
- separate `GetCSharpTypeName_ReturnsCorrectTypeNames_ForOutParameter()` test
- work around inability to deserialize a odd `ref` type
  - xUnit and vstest now serialize / deserialze test data more often
- work around microsoft/vstest#419 instead of skipping test
- enable tests that hit microsoft/vstest#427; bug has been fixed
- add `<Service>`s to test projects

nits:
- remove all web.config files
- remove conditional compilation from class libraries
- remove unnecessary project properties from `UserClassLibrary`
- move a few properties to the top of `RazorWebSite` .csproj file
- remove some trailing whitespace in .csproj files
dougbu pushed a commit to aspnet/Mvc that referenced this issue Mar 1, 2017
- thanx to @NTaylorMullen for initial conversion
  - e.g. AssemblyInfo.cs files were already minimized or removed :)
- allow `>=` RC3 CLI's to build and run MVC
- work around several dotnet migration issues; see #5482
- disable full .NET Framework runs of functional tests; see #5873
- remove `Microsoft.DotNet.InternalAbstractions` and `System.Xml.XmlDocument` dependencies
- remove project.json (!!), *.xproj, .notest, and web.config files

Redo earlier changes:
- apply test migration to .NET 4.5.2 in *.csproj world
  - see 63507c8 for previous, project.json work
- apply dependency version downgrade from 0097e40 in *.csproj world

Make other test-related changes:
- make Microsoft.AspNetCore.Mvc.TestDiagnosticListener a regular class library
- add support for `/p:GenerateBaselines=true` for functional and Razor.Host tests
- separate `GetCSharpTypeName_ReturnsCorrectTypeNames_ForOutParameter()` test
  - work around inability to deserialize a odd `ref` type
  - xUnit and vstest now serialize / deserialze test data more often
- skip poor test mentioned in #5768
- work around microsoft/vstest#392
  - rename tests to avoid duplicates
- work around microsoft/vstest#419
  - set up created `AppDomain`s with current `ApplicationBase`
@cltshivash cltshivash added the bug label Apr 9, 2018
@smadala smadala self-assigned this Aug 2, 2018
@mayankbansal018
Copy link
Contributor

@NTaylorMullen is this bug still relevant, did the work around mentioned above not work for you?

@NTaylorMullen
Copy link
Member Author

No clue, this was opened ages ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants