RSS

Category Archives: Visual Studio

Microsoft Build Conference 2016: Keynote announcements

Wanted to share across the Microsoft’s Build conference Keynote announcements that was done on March 30 2016.

Windows 10: Usage
Out for 8 months

  • 810M users world-wide
  • 270M users in US
    • 5B visitis to the Windows Store
    • 60% growth in the “last few months alone”
    • Coming soon Universal Windows Platform Apps: includes new Facebook app + audience network

Windows 10: Update
Anniversary update of Windows 10 coming this summer (FREE)

  • Update For – New Pcs, 5-year old Pcs or a Brand New Macs
  • Insider version available today along with Update of Visual Studio 2
  • Windows Hello, Ink, Gaming, Hololens, and Cortanna updates

Desktop App Converter:
Takes a modern Win32/.Net app/Game installer and runs it though Centennial tool

  • Sage example – run it through centennial and submit to the Windows 10 app store.
  • Visual studio – Win32 code with no modifications
  • Added in Live Tile code
  • Game examples with Age of Empires 2 HD

HoloLens:

  • Starts to ship to developers and enterprise partners today (exclusive to Windows 10)
  • Code example on github are available today on the Windows Store (“Galaxy Explorer”)

“Bash” shell:
Coming to Windows (native Ubuntu windows)

  • Power of command-line tools
  • example using JavaScript, ssh, Ruby and emacs

Windows Ecosystem:

  • Cortanna as a “boundary-less” offering across all devices and user actions/history

To me, in order to have Win10 capture more market, one of the most interesting support to look forward would be: Support for Win32 Desktop apps to the Windows 10 store (coming in June)

Advertisements
 
Leave a comment

Posted by on April 4, 2016 in Events, General, Microsoft, Mobile, Visual Studio

 

Tags:

“Cannot evaluate expression because the code of the current method is optimized”

Problem description:
This is one the common error faced by a lot of Visual Studio users. Typically, they get the below error message during debugging:

“Cannot evaluate expression because the code of the current method is optimized.”

Assessment:
In .NET, “Function Evaluation (funceval)” is the ability of CLR to inject some arbitrary call while the debuggee is stopped somewhere. Funceval takes charge of the debugger’s chosen thread to execute requested method. Once funceval finishes, it fires a debug event. Technically, CLR have defined ways for debugger to issue a funceval.

CLR allows to initiate funceval only on those threads that are at GC safe point (i.e. when the  thread will not block GC) and Funceval Safe (FESafe) point (i.e. where CLR can actually do the hijack for the funceval.) together. Thus, possible scenarios for CLR, a thread must be:

1. stopped in managed code  (and at a GC safe point): This implies that we cannot do a funceval in native code. Since, native code is outside the CLR’s control, it is unable to setup the funceval.

2. stopped at a 1st chance or unhandled managed exception (and at a GC safe point): i.e at time of exception, to inspect as much as possible to determine why that exception occurred. (e.g: debugger may try to evaluate and see the Message property on raised exception.)

Overall, common ways to stop in managed code include stopping at a breakpoint, step, Debugger.Break call, intercepting an exception, or at a thread start. This helps in evaluating the method and expressions.

Refer: MSDN Blog: Rules of Funceval

Possible resolutions:
Based on the assessment, if thread is not at a FESafe and GCSafe points, CLR will not be able to hijack the thread to initiate funceval. Generally, following helps to make sure funceval initiates when expected:

Step #1:

Make sure that you are not trying to debug a “Release” build. Release is fully optimized and thus will lead to the error in discussion. By using the Standard toolbar or the Configuration Manager, you can switch between Debug & Release.

For more details about it: How to: Set Debug and Release Configurations

Step #2:

If you still get the error, Debug option might be set for optimization. Verify & Uncheck the “Optimize code” property under Project “Properties”:

  • Right click the Project
  • Select option “Properties”
  • Go to “Build” tab
  • Uncheck the checkbox “Optimize code”

Step #3:

If you still get the error, Debug Info mode might be incorrect. Verify & set it to “full” under “Advanced Build Settings”:

  • Right click the Project
  • Select option “Properties”
  • Go to “Build” tab
  • Click “Advanced” button
  • Set “Debug Info” as “full”

Step #4:

If you still face the issue, try the following:

  • Do a “Clean” & then a “Rebuild” of your solution file
  • While debugging:
    1. Go to modules window (VS Menu -> Debug -> Windows -> Modules)
    2. Find your assembly in the list of loaded modules.
    3. Check the Path listed against the loaded assembly is what you expect it to be
    4. Check the modified Timestamp of the file to confirm that the assembly was actually rebuilt
    5. Check whether or not the loaded module is optimised or not
  • Remote chance could be that your call stack is getting optimized because your method signature is too large (more than 256 argument bytes). Read more about it at this MSDN blog

Conclusion:
It’s not an error but an information based on certain settings and as designed based on how .NET runtime works.

 
1 Comment

Posted by on January 26, 2013 in ASP.NET, Visual Studio

 

Tags: , , , ,