73708

AppDomain.ActivationContext is NULL

Question:

I have created an AppDomain in my application. Below is the code I have used

AppDomainSetup domaininfo = new AppDomainSetup(); domaininfo.ApplicationBase = "C:\\"; AppDomain domain = AppDomain.CreateDomain("MyDomain", null, domaininfo); ActivationContext context = domain.ActivationContext;

But the ActivationContext is null in above snippet. Can anyone help me on this. Thanks in Advance.

Answer1:

It's null by default if you don't specify an ActivationContext.

If you want an ActivationContext, use the AppDomainSetup constructor that takes an ActivationContext parameter.

Or the constructor that takes ActivationArguments which in turn has an ActivationContext.

Answer2:

ActivationContext is byte array that contains the ClickOnce deployment manifest for the application that is associated with this ActivationContext. It is used to get the ClickOnce deployment manifest for the current application.

if a ClickOnce application is running in the current AppDomain by checking the AppDomain.CurrentDomain.ActivationContext property. If that value is non-null, then the domain is running a ClickOnce application.

This can be examined by Checking the "Enable ClickOnce security settings" in Project Properties "Security" tab

In the correct context ClickOnce security settings is disabled. Because it is not a click once deployment. So the context also will be null by default

Recommend

  • JqueryUI Autocomplete : only one character is displayed per list item
  • Facebook Friend Request - Error - 'All users in param ids must have accepted TOS'
  • Using Object tags in asp.net
  • 302 Redirect from http to https in Android using Dropbox short Hyperlinks
  • Disable add to cart redirection
  • Failed to create any app request
  • Merge 2 arrays and combine results of numerical keys
  • How to click on a link that has a certain content in puppeteer?
  • Laravel 5.1 Multitenancy setup
  • django server code not updating
  • Why am I getting an Array of an Array with Doctrine 2 & Symfony 2 Data Transformer?
  • Uploading image with other parameters in SWIFT
  • ng-repeat not working with table but works with list
  • How to Divide an array on c#?
  • Is it possible to use arbitrary image sizes in caffe?
  • Runtime.exec() gives Error: Could not find or load main class
  • Doctrine2 bulk import try to work with another entity
  • Passing “get” parameters doesn't work, parameter not visible in the link
  • Elasticsearch script query involving root and nested values
  • Why use database factory in asp.net mvc?
  • Is it possible to open regedit and navigate to straight to a specific key using process.start?
  • How do I configure context broker accept post requests from my remote sensor?
  • Parse a date string in a specific locale (not timezone!)
  • Declaring variable dynamically in VB.net
  • Paperclip, set path outside of rails root folder
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • How to get address from latitude and longitude android google map v2 [duplicate]
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Submit form in a displaytag pagination
  • Modifying destination and filename of gulp-svg-sprite
  • Javascript Callbacks with Object constructor
  • Adding custom controls to a full screen movie
  • GridView Sorting works once only
  • R: gsub and capture
  • Compare two NSDates in iPhone
  • Benchmarking RAM performance - UWP and C#
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How can I remove ASP.NET Designer.cs files?
  • Net Present Value in Excel for Grouped Recurring CF