Autor Beitrag
C#
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 561
Erhaltene Danke: 65

Windows 10, Kubuntu, Android
Visual Studio 2017, C#, C++/CLI, C++/CX, C++, F#, R, Python
BeitragVerfasst: Fr 29.06.12 16:13 
Hey @ll,

ich bin vor kurzem auf ManagedSpy von Microsoft gestoßen. Jetzt wollte ich es mal testen und hab ne WinForms Anwendung erstellt und gestartet.
Gleich zu Beginn kommt der Fehler:
ausblenden C#-Quelltext
1:
2:
BadImageException
Die Datei oder Assembly "ManagedSpyLib, Version=1.0.2238.20353, Culture=neutral, PublicKeyToken=null" oder eine Abhängigkeit davon wurde nicht gefunden. Es wurde versucht, eine Datei mit einem falschen Format zu laden.


Was ist hierfür die Ursache bzw. die Lösung?

_________________
Der längste Typ-Name im .NET-Framework ist: ListViewVirtualItemsSelectionRangeChangedEventHandler
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4799
Erhaltene Danke: 1059

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Fr 29.06.12 17:18 
Hallo,

BadImageException kommt üblicherweise bei einer 32/64-bit Inkompatibilität, s. BadImageFormatException Occurs When Instantiating Types Defined in a Referenced Assembly at Run-time.

Ändere daher mal bei den Projekteinstellungen die "Zielplattform" (engl. "Target platform") (anycpu / x86 / x64).
C# Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 561
Erhaltene Danke: 65

Windows 10, Kubuntu, Android
Visual Studio 2017, C#, C++/CLI, C++/CX, C++, F#, R, Python
BeitragVerfasst: Fr 29.06.12 20:06 
Ok Danke dass klappt :). Ich dachte x86 wäre schon eingestellt.

Aber jetzt tritt noch ein anderes Problem auf:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
foreach (Process p in Process.GetProcesses())
            {
                if (p.ProcessName != targetName) continue;
                targetForm = ControlProxy.FromHandle(p.MainWindowHandle);
                break;
            }

Ich erhalte diese Win32Ausnahme:
ausblenden C#-Quelltext
1:
Nur ein Teil der ReadProcessMemory- oder WriteProcessMemory-Anforderung wurde abgeschlossen					


Wie kann ich das beheben? Hab ne Weile gesucht aber nix gefunden...

_________________
Der längste Typ-Name im .NET-Framework ist: ListViewVirtualItemsSelectionRangeChangedEventHandler
C# Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 561
Erhaltene Danke: 65

Windows 10, Kubuntu, Android
Visual Studio 2017, C#, C++/CLI, C++/CX, C++, F#, R, Python
BeitragVerfasst: Fr 29.06.12 20:19 
Habs selbst gelöst.

Das Zielfenster hatte auch die Einstellung "Any CPU" anstatt "x86". Habs umgestellt und es klappt ohne Probleme.

_________________
Der längste Typ-Name im .NET-Framework ist: ListViewVirtualItemsSelectionRangeChangedEventHandler