Ask a question
Quick access
- Home page of the forum
- Browse forum users
- Frequently asked questions
Find related topics
- Remove from my forums
He answered:
Archived forums 441-460
>
Integration with Visual Studio
Ask
-
Register to vote
I have another problem here. I get this error when I try to run a custom menu item added by the VSIP package using DTE automation.
I have a simple winforms application that runs an instance of Visual Studio and exposes a DTE object via OLE automation. I have a VSIP package registered which is basically a slightly modified ToolWindow that adds a menu to the View menu. I noticed that the VSIP package doesn't load until the menu item is clicked, so as a quick fix I want to open this window to force the VSIP package to load. I do this using DTE.ExecuteCommand("View.MyToolWindowVB").
When called, an exception is thrown indicating that the call was rejected. I can select this menu item manually without any problems, and I can also call other menu items (eg "File.NewProject") without any problems. Any ideas why I can't get this menu item to work?
The full text of the exception is below.
Account
System.Runtime.InteropServices.COMException was not handled
Error code=-2147418111
Message="Recipient rejected the call. (Exception HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))"
Resource="DTE Environment"
Batch Tracking:
w EnvDTE._DTE.ExecuteCommand (String CommandName, String CommandArgs)
w automatyzacji.Form1.Button1_Click(Object nadawca, EventArgs e) w C:\Documents and Settings\administrator.jnetd\my Documents\visual studio 2005\Projects\automationtest\automationtest\Form1.vb:line 58
w System.Windows.Forms.Control.OnClick(EventArgs e)
w System.Windows.Forms.Button.OnClick(EventArgs e)
w System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(message & m, MouseButtons button, Int32 clicks)
w System.Windows.Forms.Control.WndProc(Message&m)
w System.Windows.Forms.ButtonBase.WndProc(Message&m)
w System.Windows.Forms.Button.WndProc(Message&m)
w System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&m)
w System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&m)
w System.Windows.Forms.NativeWindow.DebuggableCallback (IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
w System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
w System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop (Int32 dwComponentID, Int32 powód, Int32 pvLoopData)
w System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner (van Int32, kontekst ApplicationContext)
w System.Windows.Forms.Application.ThreadContext.RunMessageLoop (van Int32, kontekst ApplicationContext)
at System.Windows.Forms.Application.Run(Application context)
w Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
w Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(CommandLine string [])
w automatyzacjitest.My.MyApplication.Main(String[] Args) w 17d14f5c-a337-4978-8281-53493378c1071.vb:regel 77
na System.AppDomain.nExecuteAssembly(Assembly, String[] args)
w System.AppDomain.ExecuteAssembly (String AssemblyFile, Evidence AssemblySecurity, String [] args)
w Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
w System.Threading.ThreadHelper.ThreadStart_Context (standardno)
bij System.Threading.ExecutionContext.Run (ExecutionContext ExecutionContext, ContextCallback Callback, Objectstatus)
w System.Threading.ThreadHelper.ThreadStart()Monday, July 18, 2005, 9:55 pm
Answers
-
Register to vote
Book Bill,
thank you for asking
The problem you encountered is due to a synchronization problem. It takes some time for the IDE to be up and ready to process commands. It looks like you've run into a case where the automation methods aren't actually ready to be called because the IDE isn't actually fully operational.
One way around this is to pause the application to allow VS to run fully and remain idle. A better way to achieve this is to call WaitForInputIdle, but this requires some interoperability with Windows APIs if you're writing in managed code.
If you receive this return value, it generally means that the receiver is busy and you should try again after some time.
Hope this helps you unlock.
Wednesday, July 20, 2005 21.03
All answers
-
Register to vote
Book Bill,
thank you for asking
The problem you encountered is due to a synchronization problem. It takes some time for the IDE to be up and ready to process commands. It looks like you've run into a case where the automation methods aren't actually ready to be called because the IDE isn't actually fully operational.
One way around this is to pause the application to allow VS to run fully and remain idle. A better way to achieve this is to call WaitForInputIdle, but this requires some interoperability with Windows APIs if you're writing in managed code.
If you receive this return value, it generally means that the receiver is busy and you should try again after some time.
Hope this helps you unlock.
Wednesday, July 20, 2005 21.03
(Video) God's Calling You Out Of Fear -
Register to vote
Thanks Allen. I tested this theory by inserting sen(10000) and you are absolutely right. Apparently it took the US some time to implement something.
Thank you
AccountWednesday, July 20, 2005, 10:36 p.m
- See AlsoReact-Native assembleRelease failed for task ":app:bundleReleaseJsAndAssets"Bare Metal Machines - Build or Update - REST API (Azure Azure Operator Nexus - Cloud)Solution: Microsoft Setup Bootstrapper has stopped workingResolving an object not syncing with Azure Active Directory" - Microsoft Entra
Register to vote
Setting a time limit may not be the optimal solution. What if the application is running on a much slower computer that needs more idle time?
My feeling is that you should change the whole situation with a synchronous call (using ASynchronousCallBack, but waiting an infinite amount of time for the process to complete) to block all subsequent statements until the IDE is fully loaded.
delegate
StartIDEDelegate( ); StartIDEDelegatetoneIDE=novi StartIDEDelegate(
); IAsyncResultiAsyncResult = showIDE.BeginInvoke(
,nula,nula); iAsyncResult.AsyncWaitHandle.WaitOne(-1,LIE);
callResult = showIDE.EndInvoke(iAsyncResult); So you don't have to worry if you waited too long (sleep too long) or didn't wait (sleep too little)
He entered
Thursday, January 18, 2007, 10:01 am
-
Register to vote
Bok,
I am running into the same problem here.
i need to instantiate Visual Studio and create a solution to add different projects.Kam's solution is good, but I still can't get it to work...
when I'm in debug mode it always works but when I'm running I sometimes get an exception….Kam, should I create the solution inside the delegate or just the visual studio instance?
Thank you
Ricardo
Monday, January 29, 2007 5:36 p.m
- 1
Register to vote
I run into this problem from time to time, but if you think about it, there are a few more things that need to be done.
First, opening the IDE will take some time to fully load, opening solutions or adding projects will take a little longer.
Therefore, in addition to synchronizing the "launch" time of the IDE, you must ensure that the time each project is added or each solution is opened is synchronized.
I hope it helps.
Friday, February 02, 2007, 9:21 am
-
Register to vote
Ah thanks for the answer!
in my case I don't even open solutions. I just add projects (but don't sync them).
I will try.
but one thing bothers me. I have created handlers for DTEEvents eg OnStartupComplete and it is not being logged!!!! I can't take it to the service center...
Any idea why?Thank you
(Video) Where to Begin if You’re Unsure of Your CallingFriday, February 16, 2007, 7:00 p.m
-
Register to vote
I'm not entirely sure why the event handlers aren't loading. So here I will share only some of my past experiences.
Note: I assumed that you have correctly registered the event handlers in the scheduled events.
1. Are you running the IDE in a separate thread and calling the event handlers in your UI control class?
2. Whether there is an exception before the event handler is called or while the event handler is being called.
These questions are important.
If the first question is yes and you don't have that control block for the thread you want to control, you may run into an exception that the IDE will later silence.
Solution:
Method()
{
if (this.InvokeRequired)
{
yield ()this.Call(new (this method));
}
// Whatever you intend to do.
.........
}If the first question is no, consider throwing an exception at the very beginning of your event handler.
That's all.
Hope this helps.
Friday, February 23, 2007, 7:20 a.m
-
Register to vote
I think even if you don't make a solution it will make it by default. You cannot save it.
Well, when you create a project, AddTemplate..... returns the project to you. Try to capture this item even if you choose not to use it.
You will also not face this problem if you are using an advanced machine. The vacation solution is right
Thank you
Friday, February 23, 2007, 3:30 p.m
-
Register to vote
@aahkam
Hello, thanks for your reply!
I record the event like this:
private DTE2 StartIDEMethod()
{
DTE2 dte = (DTE2) System.Activator.CreateInstance(Type.GetTypeFromProgID("VisualStudio.DTE.8.0"));
dte.Events.DTEEvents.OnStartupComplete += nowy _dispDTEEvents_OnStartupCompleteEventHandler(DTEEvents_OnStartupComplete);
return dte;
}void DTEEvents_OnStartupComplete()
{
throw new Exception("Method or operation not implemented.");
}As for starting the IDE, I did what you suggested:
he created a proxy
use IAsyncResult to wait infinitely for the BeginInvoke method to finish (starting with the IDE...)// the StartIDEMethod method in the StartIDEDelegate constructor is shown above
StartIDEDelegate startIDE = novi StartIDEDelegate(StartIDEMethod);
IAsyncResult iAsyncResult = startIDE.BeginInvoke(null, null);
iAsyncResult.AsyncWaitHandle.WaitOne(-1, waar);
startIDE.EndInvoke(iAsyncResult);I used the same process to create a solution and add two different project types...
finally i close the app and release dte
dte.Finish();
System.Runtime.InteropServices.Marshal.ReleaseComObject(dte);So yes, I run the IDE in a separate thread and call the event handlers in the UI control class. I mean, asynchronous mode is achieved by a new thread, right?
Now I am not getting the solution you provided.
Is Method() also the method used to launch the IDE?Thank you
@AmolWankhede
Thank you for your reply!
it's true that it creates a default solution, but if you don't save or build it (create a .sln) you'll only get a folder with the projects folder, no .sln to open them all.
Thank you
Monday, February 26, 2007 11:47 am
-
Register to vote
(Video) The Calling - AdrienneThanks for your opinion.
What I'm trying to say is that you may need to add a control block to make the thread a parent like below. Please avoid the throw statement (last line) in the function. Any exception that occurs in your application's events outside of the DTE is automatically silenced to prevent the application from crashing.
example:-
delegat void ParamlessVoidMethodDelegate();
void DTEEvents_OnStartupComplete()
{
if (this.InvokeRequired){
this.Invoke(new ParamlessVoidMethodDelegate(this.DTEEvents_OnStartupComplete));
yield;
}
throw new Exception("Method or operation not implemented.");
}Wed Feb 28, 2007 1:16 am
-
Register to vote
Thank you for your reply.
Now I understand what you mean.
this is very frustrating because in debug mode everything works fine and i can create solutions and add projects...
but even in debug mode onStartupCompleteEvent is never called, at least for me...
I'm catching the real event, aren't I!? (dte.Events.DTEEvents.OnStartupComplete)
anyway I used this event in case the other solution doesn't work (async calls)
just to make sure the IDE is up and running since then and can start adding projects and stuff. Tried on different computers and same thing...Thank you
- In response suggested Gapshin Dmitri Thursday, June 20, 2013 18.02
Wednesday, February 28, 2007, 9:11 am
-
Register to vote
Hello everyone
I finally think I have an answer. See the link.
Microsoft has found a solution to this problem with Some Introp.
They have this class and you have to create it and when you're done just drag things.
Perfect Perfection Good Stuff ........... I also solved my problem on a slower machine.
http://msdn2.microsoft.com/en-us/library/ms228772(VS.80).aspx
Thank you
Amol wankhede
Wednesday, February 28, 2007, 5:18 p.m
-
Register to vote
@Amol wankhede
Thank you very much for the valuable link!!! It was very helpful. He really got rid of the bastard!!
@aahkam
Thank you too! You guarded my flame... :)
Thank you both
Thursday, March 1, 2007, 9:40 a.m
-
Register to vote
Bok,
I only run into this problem in a certain environment and not in others. (the environment where my code fails by raising the above exception is faster than the other environments I've tested my code in)
To give you a brief description of the problem,
There is a service we created that runs every 24 hours, spawning another thread.
(Video) Boss REJECTED My Certification! / He Forgot Who I Am & Started Calling Me NAMES! I'm the Owner! r/MCThis thread opens instances of Word documents to create files.
Now at this stage it throws the exception "The recipient refused the connection"
Would you be so kind as to shed some light on this?
Is there any way around this other than directly or indirectly introducing a delay between the call and processing?
And if I introduced a sleep state, does the sleep time affect how my code works in different environments?
Wednesday, January 16, 2008, 11:39 am
-
Register to vote
Thanks Amol, this link is exactly what I was looking for. The title and text on the link page have no error messages for the problem it solves, so I couldn't find it while searching.
Thanks Thanks for posting this link!
Sue Wolber
Agilent-technology
Tuesday, April 15, 2008, 12:40 p.m
-
Register to vote
Thank you. Now it works perfectly.
Thursday, September 29, 2011 14.07
-
Register to vote
maybe this feature is useful to try again
use lambda(delegate) as a parameter
use: 1var selectLocal = odabir;var bereik = RunWithOutRejected(() => selectionLocal.Range);
2RunWithOutRejected(() => follow.Value.Range.FormattedText.HighlightColorIndex = WdColorIndex.wdGray25);
3var localname = name;
var bookmark = RunWithOutRejected(() => winWordControl.GetDocument().Bookmarks.Add(nameLocal, range));
name = RunWithOutRejected(() => tab.Name);
return a new KeyValuePair
(name, card); when MSword interop uses this feature, code"_application.Selection.PasteSpecial();" failed
----------------------
public static T RunWithOutRejected
(Funk function)
{
var result = default(T);
bool throws exception;Rade
{
to attempt
{
result = function();
has exception = false;
}
catch (COMException e)
{
if ( e . ErrorCode == -2147418111 )
{//Time for bed);
has exception = true;
}
Anders
{
throw away;
}
}
catch (exception)
{
throw away;
}
} while (hasException);return result;
}torta
Wednesday, 13 August 2014 09:51
-
Register to vote
Thank you Amol. This works and gives an error.
I really liked it :)
Thank you,
Karthikeyan A S
Friday, November 13, 2015 05:30
(Video) Calling John pork at 3 am!!!
FAQs
What does it mean when a call is declined? ›
If you decline a call, it goes to voicemail. You can respond with a text or remind yourself to return the call.
How can you tell if someone's phone is off? ›In the case of an off or dead phone, you'll hear voicemail or the operator's voice directly, the phone will not ring at all. If you send an iMessage or regular message, they won't receive it until their phone is turned on. Calling from another phone is the best way to check if the phone is off.
When you decline a call does it show as a missed call? ›(see more about the Android notifications settings here.) If you decline or ignore the call it will be noted as a missed call in the Android's notification drawer (accessible by swiping down from the notification bar).
Why do some iPhone calls say decline? ›The answer is deceptively straightforward: If your iPhone screen is locked, the slide-to-answer bar appears, but if your screen is unlocked and open, the decline and answer buttons will show. The elusive decline button really bums some people out.
What is the difference between Cancelled and declined call? ›"Cancelled Call" does not mean that the other person declined your call. You will only see "Cancelled Call" if you hang up quickly. If the other person presses the Decline button when you call and you're quickly transferred to voicemail, the call won't be cancelled unless you disconnect very fast.
Am I blocked or is their phone off? ›If you call and it goes straight to voicemail that means you are not blocked and the person is already on a call or their phone is off. According to Tom'sGuide.com, if you decide to leave a voicemail with a blocked number it will not go to their inbox, but instead to another inbox for blocked numbers.
Can you tell when a cell phone is turned off? ›1. Press the “Power” button on your cellphone to determine if it is powered off. The display on most cell phones will turn on once the button is pressed. If the phone is locked, the lock screen is displayed.
Am I blocked or is their phone dead? ›Call your contact back with a masked number.
If the call goes through like usual--e.g., five or more rings--then your contact has blocked your number. If the call still stops after a ring or less and diverts to voicemail, your contact's phone is dead.
“If it rings only one or two times and goes to voicemail then your call is probably declined (the recipient has manually clicked the “decline” button).”
What is the difference between call declined and not answered? ›Call Declined means not receiving calls? If someone ignores your calls and doesn't receive them, you won't see the 'Call Declined' message. The message only appears if the person you've called rejects your call.
How do you decline a call without being rude? ›
- Apologize first. This might seem like an odd piece of advice, especially if you objectively haven't done anything wrong. ...
- Don't beat around the bush. ...
- Use the actual word. ...
- Say NO twice, if you have to. ...
- Forward them to someone else. ...
- Mirror their request. ...
- Offer an alternative. ...
- Get back to them.
Go to Settings/Accessibility/Touch/Call Audio Routing and make sure Auto-Answer Calls is off. Go to Settings/Screen Time/Communications Limits. Tap each of the 2 entries and make sure both are “Everyone"
Can you decline a call on iPhone? ›You can answer, silence, or decline an incoming call. If you decline a call, it goes to voicemail. You can respond with a text or remind yourself to return the call.
What does it mean when you call someone and it doesn t ring it just hangs up? ›It may just mean the person is talking to someone else at the same time you're calling, has the phone off, or sent the call directly to voicemail. Try again later. If the one-ring and straight-to-voicemail pattern persists, it likely may be a case of a blocked number.
Does call failed mean declined? ›If the recipient of the call is a number that doesn't accept incoming calls, the call will show up as failed. Why do some numbers reject incoming calls?
Am I blocked if it goes straight to voicemail? ›One ring and straight to voicemail means you might be blocked. Even if you've been blocked, you'll still be able to ring through and leave a message -- the intended recipient simply won't be notified. When you call, there is a telltale sign to listen out for.