Have you found a solution for this problem?
I have just ported a visual studio 2010 project to 2012 and now I have the same error.
The code was not changed but i can not compile because the dll won't register.
Microsoft .NET Framework Assembly Registration Utility version 4.0.30319.18408
for Microsoft .NET Framework version 4.0.30319.18408
Copyright (C) Microsoft Corporation. All rights reserved.
RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can ca
use your assembly to interfere with other applications that may be installed on
the same computer. The /codebase switch is intended to be used only with signed
assemblies. Please give your assembly a strong name and re-register it.
RegAsm : error RA0000 : An error occurred inside the user defined Register/Unreg
ister functions: System.TypeInitializationException: The type initializer for 'K
ragtenUtilityToolBar.MeasureAngleBetweenTool' threw an exception. ---> System.Ru
ntime.InteropServices.COMException: Retrieving the COM class factory for compone
nt with CLSID {7EE9C496-D123-11D0-8383-080009B996CC} failed due to the following
error: 80040111 ClassFactory cannot supply requested class (Exception from HRES
ULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)).
The stacktrace points me to the row where I initialize a RgbColorClass.
This code did compile and register for COM Interop in visual studio 2010
Any ideas?
Thanks
have you set project x86? have you target framowork 3.5 or 4.0 (see ArcObjects Help for .NET developers for 4.0) ?
Yes, I had.
But I found the solution to the problem (in my situation).
The RgbColorClass was in a private static field of the the COM Registered class.
I initialized it immediately to a new object with braces.
"private static IRgbColor lineColor = new RgbColorClass() { Red = 255, Green = 217, Blue = 128, UseWindowsDithering = true };"
This is the row of code that did compile, but didn't register.
I Changed it to:
"private IRgbColor lineColor = null;"
And I initialized it in the constructor of the BaseTool:
"lineColor = new RgbColorClass() { Red = 255, Green = 217, Blue = 128, UseWindowsDithering = true };"
Now it did register correctly.
I have absolutely no idea why it didn't register when I initialized the static variable on declaration.
This Tool did compile and register on Arcgis 10.1 with a visual studio 2010 project.
Now on Arcgis 10.2.2 and visual studio 2012 I had to move the initialization to the constructor.
The reason why it was a static var is because the tool always used the same color to show a line.
(it doesn't change at runtime.)
Does anyone have a clue why I had to change this in the code?
It took me quite a while to figure this out, and because I don't know why, I might have the same problem on a different object in the future.
I hope this might help someone else.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.