I am developing an AddIn for Outlook.
Outlook 2013 deactivates AddIns if they take to long to start.
As i am writing my AddIn in C#, it the .Net Enviroment needs to be loaded and that takes time. The actual startup of the AddIn is very fast.
Depending on the hardware i may exceed the 1sec limit of Outlook on which the AddIn gets deactivated.
You can prevent the an AddIn from deactivation with an Registry Entry in HKEY_CURRENT_USER.
My Problem is in finding the right moment to write this Registry Entry.
At the start of the AddIn doesn't work as it may never get so far.
At the time of the installation, i can set the entry only for those users who already logged in to that particular pc.
As i am also running an service under local machine at the same pc, i could regularly update the Registry of any new user. But i would still have the problem when a Users uses that pc for the first time.
Writing the entry to the local machine registry doesn't seam to work either, as at least in my test, the missing key wasn't copied but a new one was created.
Do you have any ideas on how to prevent Outlook from disabling the AddIn
or when to write registry entry?
Do you have any ideas on how to prevent Outlook from disabling the AddIn or when to write registry entry?
I'd suggest working on the startup time of your add-in instead. Move any initialization code to another threads and make the main thread free letting Outlook running without delays. In that case you will not have to add the windows registry key.
Related
Running latest Visual Studio Community on Win10 20H2.
I'm working on a C# winforms desktop app which monitors some local drive properties and displays a status message. If a drive selected for monitoring is missing an error message is displayed providing the user an option to plugin missing drives than rerun analysis.
System.IO.DriveInfo is used to detect available drives. Data is saved/accessed with CSV files. For testing I unplug/plug-in a USB drive.
When I plug-in the "missing" drive and rerun the scan/analysis (with new instances of all contributing methods) the DriveInfo scan is not picking up the change even though Windows Explorer/file manager is detecting the change.
If I terminate and than restart the debug session the change is picked up.
Is this behavior due to VS keeping some sort of working cache during a debug session or due to my not having figured out how to Dispose of old instances properly (or something else entirely)?
Thanx in advance for your help.
I created VSTO Outlook add-in that has a button within the main ribbon of outlook and when clicked it lunches windows form. It works great to send the data from the form to the database and it composes email as well.
My problem is that users within a company that had it installed are getting slow load notification and the add-in is disabled. I tried to fix it and change all code for multi-threading but it seems not to improve the load time much. Is there any other way to make sure add-in on all user's machines is always enabled. Maybe some other way to publish other than ClickOnce.
Thanks in advance for any help.
Multithreading won't help you much - Outlook looks at your addin startup times, not the time it takes to respond to the button click.
If you are using .Net, you get punished for that - the .Net run-time has to be loaded before a single line of your addin code gets executed. Unless you switch to an unmanaged language (such as C++ or Delphi), there is nothing you can do about that.
I have a WPF application which will be used on tablets with Windows 10.
In my development environment, the application runs very fast. However, if I run the application on tablet without admin rights, the application responds very slow : all animations are slow, the scrolling is not smooth, and touch problems are visible (cannot move the caret). If the application has admin rights all things are working fine.
I tried to disable the logs, I tried to decrease the FPS, nothing seems to help.
My application is connected to a sqlite database, but even without accessing the database is very slow. There are no other connections that may require admin rights.
What could be the problem?
EDIT: Also in my dev environment the app is running slower without admin rights. I was running the VS2015 with admin rights and for that reason the application worked fine.
WPF has settings under HKEY_CURRENT_USER that can disable hardware acceleration:
https://msdn.microsoft.com/en-us/library/aa970912(v=vs.110).aspx
If the Disable Hardware Acceleration Option or the Use Reference Rasterizer Option are set, a WPF application will run slowly for that user.
Try to trace your app with Process Monitor. Run 2 traces for app running with and without admin rights. Filter your app events only via Tools->Process Tree... -> right click on your process -> Add to Include filter and compare these trace logs (or just post them here). Pay attention on gaps between registry key readings or network access.
That literally could be anything.
Mark Russinovich make a presentation almost every year about finding some interesting cases. Here's one of them.
P.S. I'm sorry to post that as an answer, but I don't have enough points to add comments right now.
To offer an answer for people that might face the same issue, now, after I've searched a lot for something helpful, I can say that this problem it is mainly a problem related to rights.
If you encounter this issue, try to run Visual Studio without admin rights and try to isolate the region where the application begins to act very slow (or the place were it crashes) . In my case, wasn't the database, or the log files, but a file in AppData which was used by an external assembly. I've seen that, every time that dll was called, the application was freezing and using dotTrace, I've managed to find which file it is used. After setting the rights (r/w) on that file, everything was back to normal.
I have a VSTO addin for Outlook 2013. The odd thing is sometimes when I do something seemingly unconnected. My button group disappears from the place it was in. Was there working perfectly for a long time. I added a ribbon group launcher, and it vanished. I then rolled back the pending changes and it still isn't there.
First, why does my ribbon group always disappear, it is set to Position: AfterOfficeId GroupMailDelete and the tab is set to TabReadMessage. This has always worked for me up until just now. I looked up the Office Id's for elements in office 2013 in the docs and they are correct (and as I said it's been fine for months).
Second, why does it not reappear when I rollback changes? I only changed that file and when I rolled back it looked like it did before I touched it.
Also it was working right until I made the change. Tested before, worked, tested again my ribbon group is gone.
I really can't stand this problem as it messes up my entire addin. Someone please offer assistance as none of the other SO answers or anything else I've found have helped.
Thanks a ton
EDIT:
Rewrote the program copying over the logic and redoing the ribbon and forms in designer. Register the event handlers was a pain as was constructing the two forms, one from EF and one using raw sql. But aside from that it works now. Why would it work when I rewrite it, but still not work when I rollback the breaking change? Not to mention that same change didn't break the copy I rewrote.
For anyone researching this in the future, try this link - which worked perfectly for me: https://msdn.microsoft.com/en-us/library/ms268871(v=vs.140).aspx
Did you check out the list of running COM add-ins right after the ribbon disappeared? Is your add-in listed in the list as an active one?
Microsoft Office applications can disable add-ins that behave unexpectedly. If an application does not load your add-in, the application might have hard disabled or soft disabled your add-in.
Hard disabling can occur when an add-in causes the application to close unexpectedly. It might also occur on your development computer if you stop the debugger while the Startup event handler in your add-in is executing.
Soft disabling can occur when an add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable an add-in if it throws an unhandled exception while the Startup event handler is executing.
When you re-enable a soft-disabled add-in, the application immediately attempts to load the add-in. If the problem that initially caused the application to soft disable the add-in has not been fixed, the application will soft disable the add-in again. Read more about that in the How to: Re-enable an Add-in That Has Been Disabled article.
Do you get any UI errors?
See How to: Show Add-in User Interface Errors for more information.
Finally, what ribbon XML do you use? Could you be more specific?
A few applications on my PC have been doing a detection wether a restart was done by Windows Update or not. This is observable due to them restarting after the automatic Windows Update reboot.
This is very helpful since those applications reload changes, even unsaved changes or restore tabs (in case of a browser). Examples of applications that do this:
Google Chrome
Microsoft Visual Studio
Microsoft Paint
In all cases the applications save the state they were in before the reboot.
(My PC actually woke up from a standby state automatically, and rebooted itself while instaling updates. Too bad it didnt go back to standby after doing this.)
My question is: How do I programmatically detect this kind of reboot? It seems to be reliably detectable before the reboot.
The question How can I get the Windows last reboot reason might seem like a duplicate, but no answer said anything about updates.
I code in C#, so an answer in C# would be helpful, though I can read C and C++ too, for example.
See Application Restart:
An application can use Application Recovery and Restart (ARR) to save data and state information before the application exits due to an unhandled exception or when the application stops responding
and:
or if the computer needs to restart as the result of an update.
The applications aren't detecting the restart reason after the fact - they've been architected to use this API. There isn't (so far as I'm aware) a managed API for this.
A couple of clicks away is Saving data and application state when application is being closed due to a software update. Again, no managed API.
Normally when Windows Reboots, it performs a restart by using shutdown.exe and the /g flag which saves the state of all registered running programs before restart. What you want to do is to Register your application for restart. There is a good sample with documentation for this by MSDN. It is available in C# and C++.