ComDefaultInterface in VB.NET for Word 2007 Addin

P

Peter Karlström

ComDefaultInterface in VB.NET for Word 2007 Addin

Hi

I'm in the middle of my first VB.NET Addin-project for Word 2007.
I tried to create a test-deployment using Publish.
When I did that, a set of Warnings came up talking about ClassInterfaceType
and ComDefaultInterface when processing my databound listboxes.
I have looked around on the net a couple of hours, without finding exactly
what I should add to my project.
The setup-files is created, and the installation of the Addin in a client PC
runs fine.
The Addin is loaded when Word is started, but when I open the the form with
the databound items, the app gets reeeealy slow.
The databound items is located in a Windows form, and the top of the
form-code looks like this:

Imports System.Data.OleDb
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Text

Public Class frmNewdoc

Private Sub frmNewdoc_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load


Me.TblWSecClassesTableAdapter.Fill(Me.SKBOfficeDBDataSet.tblWSecClasses)
Me.QryDOCplanTableAdapter1.Fill(Me.LangList.qryDOCplan)
Me.QryDOCplanTableAdapter.Fill(Me.MOBList.qryDOCplan)
Me.TblDTPTableAdapter.Fill(Me.DTPList.tblDTP)
Me.TblIHGTableAdapter.Fill(Me.IHGList.tblIHG)
Me.TblIHPTableAdapter.Fill(Me.IHPList.tblIHP)
......
......
......

I know I should put some sort of ClassInterface code to the line with Public
Class frmNewdoc, but I get confused about the syntax and how I should point
my reference to the required items.

The complete warning message looks like this:
Type library exporter warning processing
'SKBMall.MOBList+qryDOCplanDataTable, SKBMall'. Warning: Type library
exporter encountered a type that derives from a generic class and is not
marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot
be exposed for such types. Consider marking the type with
[ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface
as the default interface to COM using the ComDefaultInterface attribute.


The database is a Access 2007 accdb-file which I connect to with
System.Data.OleDb.

The development environment is Visual Studio 2008 with VB.

Hope anyone have some input on this.
 
C

Colbert Zhou [MSFT]

Hello Peter,

So have you tried to decorate the class with
[ClassInterface(ClassInterfaceType.None)]? If you already do this, but the
warning still happens. It looks like a Visual Studio bug which has already
been reported,
https://connect.microsoft.com/VisualStudio/feedback/details/93785/typelibexp
orter-warning-appears-even-for-generics-w-classinterfacetype-none?wa=wsignin
1.0
http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/07f35023-8b65-
439c-8645-26329d2900a3

But I do not see any relationship with this warnning and the performance
issue you mention in your post. So that should be another issue. I am
writing to know your main concern, the warning message or the slow
performance?

If you are mainly concerning the warning message, as I said, it should be a
known issue. If you are concerning about the performance, I think I need
some more codes or better the project to reproduce the issue in my side.
You can share me the project using email. :)


Best regards,
Ji Zhou - MSFT
Microsoft Online Community Support
 
P

Peter Karlström

Hi Colbert

I have looked for the hotfix or update for the ClassInterface bug, but I
can't figure out which of the hotfixes that takes care of this issue.

Also, this has been reported as "Microsoft is working on a solution" since
2005.
Shouldn't it then be a part of Visual Studio 2008 in its original build?
Both threads in your reply is postings from "way back".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top