Showing posts with label Bugg. Show all posts
Showing posts with label Bugg. Show all posts

Wednesday, August 31, 2011

The breakpoint will not currently be hit. no executable code is associated with this line... VS2008

Was trying to debug a ASMX web service in VS2008. But the breakpoint was not hit and when hovering over the breakpoint it said:
The breakpoint will not currently be hit. no executable code is associated with this line...
did some googling on the topic and guess what: Toggle to release and back to debug again does the trick! Writing it down in case I stumble into this again.

Saturday, April 10, 2010

Bugg i WPF implementationen av CAB ElementHostWorkspace

Hjälpte en kollega igår med ett problem som han brottats med i nästan en vecka. När WPF smartparten stängdes och en Winform smartpart skulle laddas så fick han ett exception InvalidCastException. Eftersom två par ögon ser mer en ett par så gick vi igenom felmeddelandet och stegade fram oss i koden till vi hittade raden som spökade. Vi hittade ett fel i klassen Microsoft.Practices.CompositeUI.WPF.ElementHostWorkspace:

///
/// Raises the event.
///

/// The smart part that is being closed.
protected WorkspaceCancelEventArgs RaiseSmartPartClosing(object smartPart)
{
if (smartPart is ElementHost)
{
smartPart = elementHosts.Unwrap((ElementHost)activeSmartPart);
}
WorkspaceCancelEventArgs cancelArgs = new WorkspaceCancelEventArgs(smartPart);
RaiseSmartPartClosing(cancelArgs);

return cancelArgs;
}



Felet var att variablen activeSmartPart skulle vara smartPart. Såg det genom att man kontrollerar smartPart innan man gör cast och eftersom activeSmartPart är WinForm SmartParten så smäller koden ur vid casten. Vilket innebär att koden ska se ut så här för att fungera:


///
/// Raises the event.
///

/// The smart part that is being closed.
protected WorkspaceCancelEventArgs RaiseSmartPartClosing(object smartPart)
{
if (smartPart is ElementHost)
{
smartPart = elementHosts.Unwrap((ElementHost)smartPart);
}
WorkspaceCancelEventArgs cancelArgs = new WorkspaceCancelEventArgs(smartPart);
RaiseSmartPartClosing(cancelArgs);

return cancelArgs;
}