Exemplo n.º 1
0
        public void CanSubmitFromAppDomain()
        {
            var client = new ExceptionlessClient();

            var domainSetup = new AppDomainSetup {
                ApplicationBase    = AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                ConfigurationFile  = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile,
                ApplicationName    = AppDomain.CurrentDomain.SetupInformation.ApplicationName,
                LoaderOptimization = LoaderOptimization.MultiDomainHost
            };
            AppDomain domain = AppDomain.CreateDomain("test", null, domainSetup);

            domain.UnhandledException += (sender, args) => Debug.WriteLine("Hello");

            client.Startup(domain);
            var remoteClass = new RemoteClass();

            try {
                domain.DoCallBack(() => {
                    try {
                        throw new ApplicationException();
                    } catch (Exception ex) {
                        client.SubmitError(ex);
                        throw;
                    }
                });
            } catch {}

            List <Manifest> manifests = client.Queue.GetManifests().ToList();

            Assert.Equal(1, manifests.Count);
        }
        public void CanSubmitFromAppDomain() {
            var client = new ExceptionlessClient();

            var domainSetup = new AppDomainSetup {
                ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile,
                ApplicationName = AppDomain.CurrentDomain.SetupInformation.ApplicationName,
                LoaderOptimization = LoaderOptimization.MultiDomainHost
            };
            AppDomain domain = AppDomain.CreateDomain("test", null, domainSetup);
            domain.UnhandledException += (sender, args) => Debug.WriteLine("Hello");

            client.Startup(domain);
            var remoteClass = new RemoteClass();
            try {
                domain.DoCallBack(() => {
                    try {
                        throw new ApplicationException();
                    } catch (Exception ex) {
                        client.SubmitError(ex);
                        throw;
                    }
                });
            } catch {}

            List<Manifest> manifests = client.Queue.GetManifests().ToList();
            Assert.Equal(1, manifests.Count);
        }