.Net 4.0 etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
.Net 4.0 etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

Cumartesi, Mart 14, 2009

C# 4.0: dynamic ?

I've not played with the VS2010 CTP much yet, and I've only looked briefly at the documentation and blogs about the new C# 4.0 dynamic type, but a thought occurred to me: why not have the option of making it generic as a way of saying "I will dynamically support this set of operations"?

As an example of what I mean, suppose you have an interface IMessageRouter like this:

public interface IMessageRouter
{
void Send(string message, string destination);
}

(This is an arbitrary example, by the way. The idea isn't specifically more suitable for message routing than anything else.)

I may have various implementations, written in various languages (or COM) which support the Send method with those parameters. Some of those implementations actually implement IMessageRouter but some don't. I'd like to be able to do the following:

dynamic<IMessageRouter> router = GetRouter();
// This is fine (but still invoked dynamically)
router.Send("message", turhal.temizer@netron.com.tr);
// Compilation error: no such overload
router.Send("message", "turhal.temizer@netron.com.tr", 20);

Intellisense would work, and we'd still have some of the benefits of static typing but without the implementations having to know about your interface. Of course, it would be quite easy to create an implementation of the interface which did exactly this - but now imagine that instead of IMessageRouter we had MessageRouter - a concrete class. In this case the compiler would still restrict the caller to the public API of the class, but it wouldn't have to be the real class. No checking would be performed by the compiler that your dynamic type actually supported the operations - given that we're talking about dynamic invocation, that would be impossible to do. It would instead be an "opt-in" restriction the client places on themselves. It could also potentially help with performance - if the binding involved realised that the actual type of the dynamic object natively implemented the interface or was/derived from the class, then no real dynamic calls need be made; just route all directly.

This may all sound a bit fuzzy - I'm extremely sleepy, to be honest - but I think it's a potentially interesting idea. Thoughts?

Çarşamba, Ocak 21, 2009

Visual Studio 2010 CTP VPC: Dealing with Activation Messages

Conjunction with PDC 2008, we are releasing the first Community Technology Preview of Visual Studio 2010 and the .NET Framework 4.0. You can download the release here (also see my download manager post here for a better download experience). This is an exciting release, and is jammed packed with a ton of great new features. One really nice thing about this release is the amount of work that the product teams put into writing walkthroughs which will guide you through most of the new features. I believe this will be our highest-quality Community Technology Preview yet, and we're excited to start getting your feedback on it.

This CTP is being delivered as a Virtual PC (VPC) image that you can download and run locally. In the future, we will provide a way for you to install the software on your own machine, but given where we're at with building the product the setup experience isn't quite ready. The VPC image gives us a great alternative for getting the software to you as early as possible.

This blog post is about the Activation messages you will encounter with this VPC image. In most cases, you can just ignore these messages and continue using the image. These messages are due to the way in which Windows Server 2008 and Office 2007 evaluation software works. For obvious reasons, our release criteria for distributing VPC images requires that we only ship trial software instead of fully licensed software. In the past, Windows evaluations could be configured to expire on a precise date. Due to changes in Windows Server 2008, we no longer have a firm expiration date, but there are Activation reminder messages which will appear while you are running the VPC. The good news is that these Activation messages will not cause Windows to stop working; however, you will have to dismiss some Activation messages from time to time. Note that Word/Excel/Project and Visual Studio may eventually stop working as explained below, but I have provided workarounds in all instances.

Activation Toast
While running this VPC image you will encounter a "toast" from time to time asking you to activate Windows.
Workaround: You can simply ignore this toast, or click the "X" to dismiss it.

1

"Activate Windows Now"
Starting sometime in November 2008, you will receive a modal dialog every time you boot this VPC image.
Workaround: To continue, simply click on "Activate Later." You will have to wait a few seconds before this option becomes available.
2

Word/Excel Activation
The trial versions of Word and Excel which are installed in this VPC image will only work 20 times. Every time you launch Word or Excel you will be reminded of this. After 20 uses, most Word and Excel functionality will stop working. You can still read Word and Excel documents, but you will be unable to use any of the Ribbon functionality. This means that some of the walkthroughs dealing with Word or Excel will not work.
Workaround: The first 20 times you launch Word or Excel, you can simply click "Cancel" to dismiss the activation dialog. After that, if you wish to continue using Word or Excel you will need to revert to a fresh copy of this VPC image. You can download the original VPC here.
3
After 20 uses, the Ribbon functionality in Word and Excel will become greyed out:
4

Project Activation
The Microsoft Project trial installed in this VPC image utilizes a similar limited-use mechanism to that of Word and Excel. Project will work 25 times. After that, you can no longer use Project in this VPC image. It is recommended that you only launch Project if you intend to use one of the walkthroughs that require it.
Workaround: If you need to use Project more than 25 times you should revert to a fresh copy of this VPC image. You can download the original VPC here.
5

Visual Studio 2010 CTP Expiration
Finally, the Visual Studio 2010 CTP will eventually expire. After January 1, 2009, you will no longer be able to launch the Visual Studio 2010 CTP. This is due to a hard-coded expiration date in this CTP. CTP's are pre-release software, so they aren't designed to run forever.
Workaround: If you need to continue using this VPC image after January 1, 2009, you will need to roll back the system clock in your VPC to an earlier date. In order to do so, please follow the instructions post here. Note that you should not roll back your system clock to a date prior to your last interaction with Team Foundation Server, because otherwise Team Foundation Server will get confused. If possible, I would suggest rolling back to a clean copy of the VPC (uncompress the original) and immediately disabling your clock prior to launching it for the first time.
6

Additional Notes
- No Internet Connection: This VPC image ships with Internet connections disabled. It may be tempting to want to enable an Internet connection on this VPC image in order to supply your own product key and activate this image. However, due to security reasons we strongly advise you not to connect this VPC image to any networks (intranet, Internet, etc.). There are also naming conflicts which can occur if you have multiple VPC images on the same network. Changing the computer name of this machine is not a suitable workaround, since it will break many of the walkthroughs and services.
- Hyper-V: This image was designed to work with Virtual PC 2007 SP1. We have had reports from people who have successfully converted this image to work with Hyper-V (see Grant Holliday's blog), but this may result in additional Activation implications which differ from the scenarios documented above.

In Summary
These Activation messages might seem a bit "broken" at first, but by following the workarounds explained above we hope you'll have a great experience with this VPC image. We are excited to show you a preview of what we're building, and we welcome your feedback! To provide us with your feedback, or get additional assistance using this VPC, please visit http://go.microsoft.com/fwlink/?LinkId=131310.

Source: Brain Dane

Perşembe, Kasım 06, 2008

Visual Studio 2010 Download

Download link: Microsoft Pre-release Software Visual Studio 2010 and .NET Framework 4.0 Community Technology Preview (CTP) –> 7286.0 MB

System Requirements
  • Supported Operating Systems: Windows Server 2003; Windows Server 2008; Windows Vista; Windows XP
  • Minimum 75 GB available HDD space
  • The host computer must have a minimum of 2 GB RAM, with 1 GB allocated to the host operating system and 1 GB allocated to the VPC.
  • We recommend that the host computer CPU be at least a Core Duo 2 GHz processor.
  • Service Pack 1 of Microsoft Virtual PC 2007 is required to access the VPC.

To upgrade Microsoft Virtual PC 2007 to Service Pack 1, download and install the update from: http://www.microsoft.com/downloads/details.aspx?FamilyID=28c97d22-6eb8-4a09-a7f7-f6c7a1f000b5&DisplayLang=en
If the host computer has more than 2 GB RAM, you can increase performance of your VPC by allocating more memory to the VPC. After that change to the VM settings, you will need to update the page file inside the guest OS to be 1.5 times the amount of RAM you’ve allocated.
Instructions

To install, follow these instructions in the exact order shown.

  1. Download and install Virtual PC 2007 and then upgrade to Virtual PC 2007 Service Pack 1.
  2. Click the Download buttons on this page to download all parts of the Visual Studio 2010 and .NET Framework 4.0 CTP. The first part is a self-extracting EXE and will prompt for the other parts.
  3. VisualStudio2010CTP_11PartsTotal.part01.exe extracts two files (VisualStudio2010CTP.vhd and VisualStudio2010CTP.vmc). You will need to read and accept the License Terms before extraction proceeds.
  4. Launch the Virtual PC Console.
  5. Click the New button to launch the “New Virtual Machine Wizard”.
  6. Navigate to the Options page and select "Add An existing Virtual Machine" radio button.
  7. Click the Browse button and navigate to the location you extracted the files to and select the VisualStudio2010CTP.vmc image.
  8. Select the “When I click Finish, Open Settings” checkbox and click Finish.
  9. On the left pane for the dialog "Settings for VisualStudio2010CTP", select Hard Disk 1. Then on the righ pane, select the button "Virtual hard disk file", and navigate to the location of VisualStudio2010CTP.vhd that you downloaded during Step 3 above. Click ok to close the dialog.
  10. Select the new image entry, VisualStudio2010CTP, and click Start.
  11. To logon to the machine, click on Action Menu (Shortcut: Right Alt+Del) on the VPC console and use the following credentials:
    To run the walkthroughs you must logon using the TFSSETUP account with password of 1Setuptfs.
    The following logon accounts and passwords have been preconfigured on the VPC:
    • Administrator: TFSSETUP, password: 1Setuptfs (use this account to explore the CTP)
    • Administrator: Administrator,password: P2ssw0rd
    • User: TFSREPORTS, password: 1Reports
    • User: TFSSERVICE, password: 1Service

Good coding.

Source: Microsoft :)