- December 6, 2004
- 2,055
- 318
I just cannot figure this out:
Take the following code:
throws InvalidCastException telling me:
Yeah.......right. If I do:
then dlgYesNo == null.....because again it can't cast.
GUIDialogYesNo dlgYesNo = new GUIDialogYesNo(); works, but I cannot use that window as it throws a nullreference exception as soon as I do doModul
GUIWindow wind = GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
also works, because no cast is involved.
Now, GetType().Fullname both return MediaPortal.Dialogs.GUIDialogYesNo
GetType().GUID both return the exact same value too
for new GUIDialogYesNo() and GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO)
I am compiling against the exact same Dialogs.dll as MP is loading at runtime.
It also happens with
but there I can go the route of:
unfortunatly guidialogyesno does not implement such an interface.
I guess the question is.....what can cause a type to be uncastable to itself?
It used to always work fine, but suddently stopped, unfortunatly I don't know what I changed or even exactly when it occured.
Take the following code:
Code:
GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
Das Objekt des Typs MediaPortal.Dialogs.GUIDialogYesNo kann nicht in Typ MediaPortal.Dialogs.GUIDialogYesNo umgewandelt werden.
Yeah.......right. If I do:
Code:
GUIDialogYesNo dlgYesNo = GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO) as GUIDialogYesNo;
GUIDialogYesNo dlgYesNo = new GUIDialogYesNo(); works, but I cannot use that window as it throws a nullreference exception as soon as I do doModul
GUIWindow wind = GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
also works, because no cast is involved.
Now, GetType().Fullname both return MediaPortal.Dialogs.GUIDialogYesNo
GetType().GUID both return the exact same value too
for new GUIDialogYesNo() and GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO)
I am compiling against the exact same Dialogs.dll as MP is loading at runtime.
It also happens with
Code:
GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
Code:
IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
I guess the question is.....what can cause a type to be uncastable to itself?
It used to always work fine, but suddently stopped, unfortunatly I don't know what I changed or even exactly when it occured.
Denmark