i want to use ILspy debug a dll,as pic:
but it only can show two process:
but in vs2010,i can attach more process:
how to show w3wp.exe in ILspy? who can help me?
Running ILSpy as an administrator solved this problem for me.
From the ILSpy source code (ICSharpCode.ILSpy.Debugger.UI.AttachToProcessWindow):
Process currentProcess = Process.GetCurrentProcess();
foreach (Process process in Process.GetProcesses()) {
try {
if (process.HasExited) continue;
// Prevent attaching to our own process.
if (currentProcess.Id != process.Id) {
bool managed = false;
try {
var modules = process.Modules.Cast<ProcessModule>().Where(
m => m.ModuleName.StartsWith("mscor", StringComparison.OrdinalIgnoreCase));
managed = modules.Count() > 0;
} catch { }
if (managed) {
list.Add(new RunningProcess {
ProcessId = process.Id,
ProcessName = Path.GetFileName(process.MainModule.FileName),
FileName = process.MainModule.FileName,
WindowTitle = process.MainWindowTitle,
Managed = "Managed",
Process = process
});
}
}
} catch (Win32Exception) {
// Do nothing.
}
}
Seems relatively straight forward...
It is preview software, so perhaps there is a flaw in this algorithm for determining if a process uses managed code.
You might be able to move pass this issue just by downloading the source code and changing
bool managed = false;
to
bool managed = true;
and recompiling.
I don't have the full version of IIS7 installed so I can't attempt to recreate your issue, but I doubt I would have the same problem anyways because my visual studio development server shows up fine in ILSpy while yours does not. Perhaps there is something different about your environment that messes with the above algorithm.
32-bit vs 64-bit might also play some role
Related
So I'm currently writing an extension for VS using their extensibility API, and I've run into a bit of a snag. I need some kind of event (or other solution) that triggers when you tab between files, and when that happens I need to get the path to the new active document.
The problem is everything in the API that I have tried either fires at the wrong time, or when it is called, the current active document hasn't been updated yet so when I get the path it's still the file I just tabbed out of.
I've tried implementing the IVsRunningDocTableEvents interface, I've tried using the Events.WindowEvents.WindowActivated event, nothing so far has worked correctly.
EditorClassifier1Provider.myEnvDTE.DTE.Events.WindowEvents.WindowActivated += WindowEvents_WindowActivated;
class RdtEvents : IVsRunningDocTableEvents
{
public RdtEvents()
{
ThreadHelper.ThrowIfNotOnUIThread();
var rdt = (IVsRunningDocumentTable)Package.GetGlobalService(typeof(IVsRunningDocumentTable));
rdt.AdviseRunningDocTableEvents(this, out _);
}
int IVsRunningDocTableEvents.OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame)
{
OpenConnectionCommand.docView = VS.Documents.GetActiveDocumentViewAsync().Result;
Message.Send(null, null);
OpenConnectionCommand.docView.Document.DirtyStateChanged += (s,e) => Message.Send();
OpenConnectionCommand.docView.TextView.Selection.SelectionChanged += (s,e) => Message.Send();
return Microsoft.VisualStudio.VSConstants.S_OK;
}
//...etc
I have a large proces that I need to debug and the proces could stop at anytime. I have configured Visual Studio 2017, to stop at any thrown exception, as in, even if it is handled, because I want to see what caused the exception. What I need is some sort of alarm when this happens, so that I can leave the program to run and then alert me if anything comes up. The only thing I have found is an alarm sound when a break point is hit, but it might not be a break point and I need more than a sound, I need to be able to execute some code, so that I can make my Phone go nuts or whatever. Is there any way I can trigger code when the debugger enters break mode?
Thanks in advance.
It is, using a VS package. You'll need to add this attribute on top of the class in order for code to run on package startup:
[ProvideAutoLoad(Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.SolutionExists)] ///Able to run code on solution startup
Add these class values variables:
private DTE2 applicationObject;
private BuildEvents buildEvents;
private DebuggerEvents debugEvents;
then the following code can run:
protected override void Initialize()
{
base.Initialize();
applicationObject = (DTE2)GetService(typeof(DTE));
buildEvents = applicationObject.Events.BuildEvents;
debugEvents = applicationObject.Events.DebuggerEvents;
SetupEventHandlers();
}
And finally the code we have "all" being waiting for:
private void SetupEventHandlers()
{
//buildEvents.OnBuildDone += (scope, action) =>
//{
//};
debugEvents.OnEnterBreakMode += delegate (dbgEventReason reason, ref dbgExecutionAction action)
{
};
//var componentModel =
// GetGlobalService(typeof(SComponentModel)) as IComponentModel;
//if (componentModel == null)
//{
// Debug.WriteLine("componentModel is null");
// return;
//}
//var operationState = componentModel.GetService<IOperationState>();
//operationState.StateChanged += OperationStateOnStateChanged;
}
Hope to find some guidance on this one soon, I've added reference for Windows IoT UWT in my project but still getting the following error ?
An exception of type 'System.TypeLoadException' occurred in test_led_alljoyn.exe but was not handled in user code
Additional information: Could not find Windows Runtime type 'Windows.Devices.Gpio.GpioController'.
Has anyone come across this issue while compiling applications for Raspberry Pi on Windows IoT core, on it's own one of my sample push button app works fine. Here's my code
public IAsyncOperation<testlightbulbSwitchResult> SwitchAsync(AllJoynMessageInfo info, bool interfaceMemberOn)
{
return (Task.Run(() =>
{
SwitchLED(interfaceMemberOn);
return testlightbulbSwitchResult.CreateSuccessResult();
}).AsAsyncOperation());
}
private void SwitchLED (bool state)
{
_ledState = state;
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Devices.Gpio.GpioController"))
{
this.tController = GpioController.GetDefault();
if (this.tController == null)
{
//GpioStatus.Text = "There is no GPIO controller on this device.";
//return;
this.tPin = this.tController.OpenPin(5);
this.tPin.Write(GpioPinValue.High);
this.tPin.SetDriveMode(GpioPinDriveMode.Output);
}
this.tPin.Write(_ledState ? GpioPinValue.Low : GpioPinValue.High);
}
}
Solved. I had to set build platform target compile with .net native tool chain.
I am developing a UWP windows 10 application and I want to have a page that is only shown at the start of launching application first time. It should not be shown when the app is opened second time in a system.
I have searched online about it but couldn't find any thing about it.
I know that my answer can be refined more, but i have done with spending 2 minutes and its working for me. I have added a page loaded event in my StartPage.xaml.cs file and added the following code inside it.
if (localSettings.Values["IsFirstTime"] == null)
{
localSettings.Values["IsFirstTime"] = true;
}
if ((bool)localSettings.Values["IsFirstTime"])
{
localSettings.Values["IsFirstTime"] = false;
this.Frame.Navigate(typeof(MainPage));
}
Make sure you make a localSettings object at class level (of type ApplicationDataContainer). Now inside App.xaml.cs, I have added global variable for local settings as follow.
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
Inside app.xaml.cs file come to the if condition showing rootFrame.Content == null and replace every thing inside it with the following code.
object value = localSettings.Values["IsFirstTime"];
if (localSettings.Values["IsFirstTime"] != null)
{
if ((bool)value)
{
rootFrame.Navigate(typeof(StartPage), e.Arguments);
localSettings.Values["IsFirstTime"] = false;
}
else
{
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
}
else
{
rootFrame.Navigate(typeof(StartPage), e.Arguments);
localSettings.Values["IsFirstTime"] = false;
}
I have tried it by uninstalling my app and run again to see if start page is shown (and it shows up). Second time when i open, MainPage is shown).
In App.xaml.cs look for the OnLaunched handler. There are these lines of code for "switching" pages:
if (rootFrame.Content == null)
{
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
As #Romasz suggested in comments, you can add here additional logic with local (or better - roaming) storage to check whether app is launched for the first time:
var roamingSettings = ApplicationData.Current.RoamingSettings;
if (roamingSettings.Values.ContainsKey("NotFirstTimeLaunch"))
{
rootFrame.Navigate(typeof(MainPage), e.Arguments);
} else
{
roamingSettings.Values["NotFirstTimeLaunch"] = true;
rootFrame.Navigate(typeof(FirstLaunchPage), e.Arguments);
}
I recently started a new testing job and my predecessor ran an automation suite using watin, which I've had no previous experience with so I'm sorry if I'm not able to give you the relevant information
When I run the suite it (against IE 8.0.7601.17514) seems to get stuck when ever there is a confirmation dialog and the next step is to press ok
//Enter invalid data
var confirmDialog = new ConfirmDialogHandler();
IE.DialogWatcher.Add(confirmDialog);
using (new UseDialogOnce(IE.DialogWatcher, confirmDialog))
{
//Click to reset data entry
IE.Page<DataEntryPage>().ResetVoucherButton.ClickNoWait();
confirmDialog.WaitUntilExists(40000);
confirmDialog.OKButton.Click();
WaitForPostBackToComplete.WaitForAsyncPostBackToComplete(IE);
}
It just hangs there and waits for the time out period to pass.
I thought the problem was with my IEStaticInstanceHelper.cs file but it seems to be correct
using System.Threading;
using WatiN.Core;
namespace WatiN
{
public class IEStaticInstanceHelper
{
private IE _ie;
private int _ieThread;
private string _ieHwnd;
public IE IE
{
get
{
var currentThreadId = GetCurrentThreadId();
if (currentThreadId != _ieThread)
{
_ie = IE.AttachTo<IE>(Find.By("hwnd", _ieHwnd));
_ieThread = currentThreadId;
}
return _ie;
}
set
{
_ie = value;
_ieHwnd = _ie.hWnd.ToString();
_ieThread = GetCurrentThreadId();
}
}
private int GetCurrentThreadId()
{
return Thread.CurrentThread.GetHashCode();
}
}
}
I've recently rebuilt my computer (well my sysadmin did) and this wasn't an issue before it was rebuilt, but I can't think what may have changed
Any help would be greatly appreciated
Edit
I didn't actually have to change the code, I just had to update my Watin Version as it couldn't handle what ever differences there were between earlier IE 8 dialog boxes and newer ones.
I had a similar problem with IE 9.
I used the following to simulate the shortcut keys on the dialogue
using (browser)
{
SendKeys.SendWait("+(%S)");
}
Send Keys = http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx
Does this help?