Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / August 2005

Tip: Looking for answers? Try searching our database.

Trouble reading TextEditor package fonts and colors

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthew Etter - 23 Aug 2005 17:19 GMT
We would like our package settings to match the user's preferences for fonts
and colors. To do this we have been reading the TextEditor category settings
using the IVsFontAndColorStorage service interface. But we have run into a
problem. If we operate against a "clean" Visual Studio registry hive (using
vsregex or devenv /setup), the call to IVsFontAndColorStorage::OpenCategory
fails. And not just an E_FAIL return code failure. I get a memory exception.
I have tried passing every combination of FCSTORAGEFLAGS I can think of
(with and without FCSF_LOADDEFAULTS, with and without FCSF_READONLY, etc),
but I still get the same memory exception.

(The memory exception reads.. An unhandled exception of type
'System.AccessViolationException' occurred in System.Windows.Forms.dll
Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.)

I have tried some alternate approaches. I used the
IVsFontAndColorCacheManager service interface to call CheckCache and/or
RefreshCache against the same category guid. The behavior was inconsistent.
Sometimes it would allow the subsequent calls to OpenCategory to succeed,
sometimes not.

I then tried loading the TextEditor package as a service, a querying for the
IVsFontAndColorDefaultsProvider interface. So far, so good. I was able to
call IVsFontAndColorDefaultsProvider::GetObject with success, and retrieved
the IVsFontAndColorDefaults interface for the TextEditor category. But
again, calling IVsFontAndColorDefaults::GetItemCount, ::GetItem or
::GetItemByName fails with the same memory exception.

Any idea on how to make sure the TextEditor category settings have been
initialized? (Safely?)

Thanks,
--Matthew
Matthew Etter - 23 Aug 2005 21:46 GMT
Never mind! I found that the problem actually was the fault of some custom
External Text Markers defined in another package. The package
(marker-providing package) was having its IVsTextMarkerTypeProvider
interface called before the package was initialized. The marker was
therefore providing invalid values to the TextEditor colors settings,
causing a problem in the IDE.

Sorry about the false alarm.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.