Получил проект, в котором используется Microsoft Visio 11.0 Drawning Control.
Разработка ведется в MS VS 2008 на C#.
Суть проблемы: при запуске на Win7 x64 валится с ошибкой
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
System.AccessViolationException: Попытка чтения или записи в защищенную память. Это часто свидетельствует о том, что другая память повреждена.
в System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
в System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
в System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
в System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
в System.Windows.Forms.AxHost.CreateInstance()
в System.Windows.Forms.AxHost.GetOcxCreate()
в System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
в System.Windows.Forms.AxHost.CreateHandle()
в System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
в System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
в System.Windows.Forms.AxHost.EndInit()
в BPViewer.FBusinessProcessScheme.InitializeComponent()
в \BPViewer\FBusinessProcessScheme.Designer.cs:строка 261
в BPViewer.FBusinessProcessScheme..ctor(OracleConnection connection, Int64 id, Boolean readOnly)
в BPViewer\FBusinessProcessScheme.cs:строка 34
в BPViewer.Routines.ShowBusinessProcess(Form parent, OracleConnection conn, Int64 id)
в \BPViewer\Routines.cs:строка 1039
в BPViewer.FBusinessProcess.MiBpSchemeClick(Object sender, EventArgs e)
в BPViewer\FBusinessProcess.cs:строка 70
в System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
в System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
в System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
в System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
в System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
в System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
в System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
в System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
в System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
в System.Windows.Forms.Control.WndProc(Message& m)
в System.Windows.Forms.ScrollableControl.WndProc(Message& m)
в System.Windows.Forms.ToolStrip.WndProc(Message& m)
в System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
в System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
При этом на Win7 x32 отрабатывает превосходно - открывается схема, построенная в Visio.
Ошибка происходит при вызове метода InitializeComponent() формы, на которой расположен компонент Microsoft Visio 11.0 Drawning Control в строчке ((System.ComponentModel.ISupportInitialize)(this.dcScheme)).EndInit();
Вот код, из которого при копировании сюда убрал упоминания о других компонентах.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
namespace BPViewer
{
partial class FBusinessProcessScheme
{
/// <summary>
/// Требуется переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором форм Windows
/// <summary>
/// Обязательный метод для поддержки конструктора - не изменяйте
/// содержимое данного метода при помощи редактора кода.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FBusinessProcessScheme));
this.dcScheme = new AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl();
((System.ComponentModel.ISupportInitialize)(this.dcScheme)).BeginInit();
this.SuspendLayout();
// dcScheme
//
this.dcScheme.Dock = System.Windows.Forms.DockStyle.Fill;
this.dcScheme.Enabled = true;
this.dcScheme.Location = new System.Drawing.Point(0, 0);
this.dcScheme.Name = "dcScheme";
this.dcScheme.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("dcScheme.OcxState")));
this.dcScheme.Size = new System.Drawing.Size(600, 499);
this.dcScheme.TabIndex = 3;
this.dcScheme.SelectionChanged += new AxMicrosoft.Office.Interop.VisOcx.EVisOcx_SelectionChangedEventHandler(this.DcSchemeSelectionChanged);
this.dcScheme.ShapeAdded += new AxMicrosoft.Office.Interop.VisOcx.EVisOcx_ShapeAddedEventHandler(this.dcScheme_ShapeAdded);
//
//AccessViolation валится здесь!
((System.ComponentModel.ISupportInitialize)(this.dcScheme)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
internal AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl dcScheme;
}
}
В свойствах проекта Platform Target выставлено в x86.
ЧЯДНТ? Установлен MS Visio 2003 с компонентом .Net Programmability support. Почему на x32 запускается нормально, а на x64 валится именно на окончании инициализации компонента и как это можно поправить?
ЗЫ. Эта ветка форума показалась наиболее подходящей для данного вопроса. Напишите, если думаете, что ее нужно перенести в другую ветку.