2014-11-11 After the installation of the Microsoft.NET Framework 4.6, users may experience the following dialog box displayed in Microsoft Visual Studio when either creating new Web Site or Windows Azure project or when opening existing projects.
-->Standalone applications typically have a main window that both displays the main data over which the application operates and exposes the functionality to process that data through user interface (UI) mechanisms like menu bars, tool bars, and status bars. A non-trivial application may also display additional windows to do the following:
2019-11-20 Im currently having a hard time of solving this problem. I had just upgraded my website to Silverlight 5 and this message is what i get: I have take a look at the Microsoft-Silverlight Configuration dialog box and verified that application storage is enabled: This is. 2020-4-3 The Official site of Microsoft Silverlight. Download and install the latest version Microsoft Silverlight plug in for your browser. Silverlight™ 2 includes a number of changes in the Windows® Presentation Foundation (WPF) UI framework: new controls, rich networking APIs, and Digital Rights Management (DRM) support. One major change in Silverlight 2 is the ability to use Microsoft®.NET-compliant languages to. Silverlight 4.0; Support for Microsoft DirectX® 9.0 graphics with Windows Vista Display Driver Model (WDDM) Driver, 128 MB of graphics RAM or more, Pixel Shader 3.0 in hardware, 32-bits per pixel. In the Install dialog box, click Run. Related Resources. Skype for Business on Mac 04 Mouse and Keyboard Center 12. A computer administrator can configure the Silverlight auto-updater for all users. This configuration will disable the Updates tab of the Microsoft Silverlight Configuration dialog box to prevent individual users from ignoring the administrator’s setting. This configuration will disable the Updates tab of the Microsoft Silverlight Configuration dialog box to prevent individual users from ignoring the administrator’s setting. See the Silverlight Enterprise Deployment Guide to learn more about how to set the auto-update configuration for all users. Turning off automatic updates.
Display specific information to users.
Gather information from users.
Both display and gather information.
These types of windows are known as dialog boxes, and there are two types: modal and modeless.
A modal dialog box is displayed by a function when the function needs additional data from a user to continue. Because the function depends on the modal dialog box to gather data, the modal dialog box also prevents a user from activating other windows in the application while it remains open. In most cases, a modal dialog box allows a user to signal when they have finished with the modal dialog box by pressing either an OK or Cancel button. Pressing the OK button indicates that a user has entered data and wants the function to continue processing with that data. Pressing the Cancel button indicates that a user wants to stop the function from executing altogether. The most common examples of modal dialog boxes are shown to open, save, and print data.
A modeless dialog box, on the other hand, does not prevent a user from activating other windows while it is open. For example, if a user wants to find occurrences of a particular word in a document, a main window will often open a dialog box to ask a user what word they are looking for. Since finding a word doesn't prevent a user from editing the document, however, the dialog box doesn't need to be modal. A modeless dialog box at least provides a Close button to close the dialog box, and may provide additional buttons to execute specific functions, such as a Find Next button to find the next word that matches the find criteria of a word search.
Windows Presentation Foundation (WPF) allows you to create several types of dialog boxes, including message boxes, common dialog boxes, and custom dialog boxes. This topic discusses each, and the Dialog Box Sample provides matching examples.
Message boxes
A message box is a dialog box that can be used to display textual information and to allow users to make decisions with buttons. The following figure shows a message box that displays textual information, asks a question, and provides the user with three buttons to answer the question.
To create a message box, you use the MessageBox class. MessageBox lets you configure the message box text, title, icon, and buttons, using code like the following.
To show a message box, you call the static
Show method, as demonstrated in the following code.
Dialog Box Computer
When code that shows a message box needs to detect and process the user's decision (which button was pressed), the code can inspect the message box result, as shown in the following code.
For more information on using message boxes, see MessageBox, MessageBox Sample, and Dialog Box Sample.
Although MessageBox may offer a simple dialog box user experience, the advantage of using MessageBox is that is the only type of window that can be shown by applications that run within a partial trust security sandbox (see Security), such as XAML browser applications (XBAPs).
Most dialog boxes display and gather more complex data than the result of a message box, including text, selection (check boxes), mutually exclusive selection (radio buttons), and list selection (list boxes, combo boxes, drop-down list boxes). For these, Windows Presentation Foundation (WPF) provides several common dialog boxes and allows you to create your own dialog boxes, although the use of either is limited to applications running with full trust.
Common dialog boxes
Windows implements a variety of reusable dialog boxes that are common to all applications, including dialog boxes for opening files, saving files, and printing. Since these dialog boxes are implemented by the operating system, they can be shared among all the applications that run on the operating system, which helps user experience consistency; when users are familiar with the use of an operating system-provided dialog box in one application, they don't need to learn how to use that dialog box in other applications. Because these dialog boxes are available to all applications and because they help provide a consistent user experience, they are known as common dialog boxes.
Windows Presentation Foundation (WPF) encapsulates the open file, save file, and print common dialog boxes and exposes them as managed classes for you to use in standalone applications. This topic provides a brief overview of each.
Open File dialog
The open file dialog box, shown in the following figure, is used by file opening functionality to retrieve the name of a file to open.
The common open file dialog box is implemented as the OpenFileDialog class and is located in the Microsoft.Win32 namespace. The following code shows how to create, configure, and show one, and how to process the result.
For more information on the open file dialog box, see Microsoft.Win32.OpenFileDialog.
Note
OpenFileDialog can be used to safely retrieve file names by applications running with partial trust (see Security).
Save File dialog box
The save file dialog box, shown in the following figure, is used by file saving functionality to retrieve the name of a file to save.
The common save file dialog box is implemented as the SaveFileDialog class, and is located in the Microsoft.Win32 namespace. The following code shows how to create, configure, and show one, and how to process the result.
For more information on the save file dialog box, see Microsoft.Win32.SaveFileDialog.
Print dialog box
The print dialog box, shown in the following figure, is used by printing functionality to choose and configure the printer that a user would like to print data to.
The common print dialog box is implemented as the PrintDialog class, and is located in the System.Windows.Controls namespace. The following code shows how to create, configure, and show one.
For more information on the print dialog box, see System.Windows.Controls.PrintDialog. For detailed discussion of printing in WPF, see Printing Overview.
Custom dialog boxes
While common dialog boxes are useful, and should be used when possible, they do not support the requirements of domain-specific dialog boxes. In these cases, you need to create your own dialog boxes. As we'll see, a dialog box is a window with special behaviors. Window implements those behaviors and, consequently, you use Window to create custom modal and modeless dialog boxes.
Creating a modal custom dialog box
This topic shows how to use Window to create a typical modal dialog box implementation, using the Margins
dialog box as an example (see Dialog Box Sample). The Margins
dialog box is shown in the following figure.
Configuring a modal dialog box
The user interface for a typical dialog box includes the following:
The various controls that are required to gather the desired data.
An OK button that users click to close the dialog box, return to the function, and continue processing.
A Cancel button that users click to close the dialog box and stop the function from further processing.
A Close button in the title bar.
An icon.
Minimize, Maximize, and Restore buttons.
A System menu to minimize, maximize, restore, and close the dialog box.
A position above and in the center of the window that opened the dialog box.
The ability to be resized where possible to prevent the dialog box from being too small, and to provide the user with a useful default size. This requires that you set both the default and a minimum dimensions.
The ESC key as a keyboard shortcut that causes the Cancel button to be pressed. You do this by setting the IsCancel property of the Cancel button to
true
.The ENTER (or RETURN) key as a keyboard shortcut that causes the OK button to be pressed. You do this by setting the IsDefault property of the OK button
true
.
The following code demonstrates this configuration.
The user experience for a dialog box also extends into the menu bar of the window that opens the dialog box. When a menu item runs a function that requires user interaction through a dialog box before the function can continue, the menu item for the function will have an ellipsis in its header, as shown here.
When a menu item runs a function that displays a dialog box which does not require user interaction, such as an About dialog box, an ellipsis is not required.
Opening a modal dialog box
A dialog box is typically shown as a result of a user selecting a menu item to perform a domain-specific function, such as setting the margins of a document in a word processor. Showing a window as a dialog box is similar to showing a normal window, although it requires additional dialog box-specific configuration. The entire process of instantiating, configuring, and opening a dialog box is shown in the following code.
Here, the code passes default information (the current margins) to the dialog box. It also sets the Window.Owner property with a reference to the window that is showing the dialog box. In general, you should always set the owner for a dialog box to provide window state-related behaviors that are common to all dialog boxes (see WPF Windows Overview for more information).
Note
You must provide an owner to support user interface (UI) automation for dialog boxes (see UI Automation Overview).
After the dialog box is configured, it is shown modally by calling the ShowDialog method.
Validating user-provided data
When a dialog box is opened and the user provides the required data, a dialog box is responsible for ensuring that the provided data is valid for the following reasons:
From a security perspective, all input should be validated.
From a domain-specific perspective, data validation prevents erroneous data from being processed by the code, which could potentially throw exceptions.
From a user-experience perspective, a dialog box can help users by showing them which data they have entered is invalid.
From a performance perspective, data validation in a multi-tier application can reduce the number of round trips between the client and the application tiers, particularly when the application is composed of Web services or server-based databases.
To validate a bound control in WPF, you need to define a validation rule and associate it with the binding. A validation rule is a custom class that derives from ValidationRule. The following example shows a validation rule, MarginValidationRule
, which checks that a bound value is a Double and is within a specified range.
In this code, the validation logic of a validation rule is implemented by overriding the Validate method, which validates the data and returns an appropriate ValidationResult.
To associate the validation rule with the bound control, you use the following markup.
Once the validation rule is associated, WPF will automatically apply it when data is entered into the bound control. When a control contains invalid data, WPF will display a red border around the invalid control, as shown in the following figure.
WPF does not restrict a user to the invalid control until they have entered valid data. This is good behavior for a dialog box; a user should be able to freely navigate the controls in a dialog box whether or not data is valid. However, this means a user can enter invalid data and press the OK button. For this reason, your code also needs to validate all controls in a dialog box when the OK button is pressed by handling the Click event.
This code enumerates all dependency objects on a window and, if any are invalid (as returned by GetHasError, the invalid control gets the focus, the IsValid
method returns false
, and the window is considered invalid.
Once a dialog box is valid, it can safely close and return. As part of the return process, it needs to return a result to the calling function.
Setting the modal dialog result
Opening a dialog box using ShowDialog is fundamentally like calling a method: the code that opened the dialog box using ShowDialog waits until ShowDialog returns. When ShowDialog returns, the code that called it needs to decide whether to continue processing or stop processing, based on whether the user pressed the OK button or the Cancel button. To facilitate this decision, the dialog box needs to return the user's choice as a Boolean value that is returned from the ShowDialog method.
When the OK button is clicked, ShowDialog should return true
. This is achieved by setting the DialogResult property of the dialog box when the OK button is clicked.
Note that setting the DialogResult property also causes the window to close automatically, which alleviates the need to explicitly call Close.
When the Cancel button is clicked, ShowDialog should return false
, which also requires setting the DialogResult property.
When a button's IsCancel property is set to true
and the user presses either the Cancel button or the ESC key, DialogResult is automatically set to false
. The following markup has the same effect as the preceding code, without the need to handle the Click event.
A dialog box automatically returns false
when a user presses the Close button in the title bar or chooses the Close menu item from the System menu.
Processing data returned from a modal dialog box
When DialogResult is set by a dialog box, the function that opened it can get the dialog box result by inspecting the DialogResult property when ShowDialog returns.
If the dialog result is true
, the function uses that as a cue to retrieve and process the data provided by the user.
Note
After ShowDialog has returned, a dialog box cannot be reopened. Instead, you need to create a new instance.
If the dialog result is false
, the function should end processing appropriately.
Creating a modeless custom dialog box
A modeless dialog box, such as the Find Dialog Box shown in the following figure, has the same fundamental appearance as the modal dialog box.
However, the behavior is slightly different, as described in the following sections.
Opening a modeless dialog box
A modeless dialog box is opened by calling the Show method.
Unlike ShowDialog, Show returns immediately. Consequently, the calling window cannot tell when the modeless dialog box is closed and, therefore, does not know when to check for a dialog box result or get data from the dialog box for further processing. Instead, the dialog box needs to create an alternative way to return data to the calling window for processing.
Processing data returned from a modeless dialog box
In this example, the FindDialogBox
may return one or more find results to the main window, depending on the text being searched for without any specific frequency. As with a modal dialog box, a modeless dialog box can return results using properties. However, the window that owns the dialog box needs to know when to check those properties. One way to enable this is for the dialog box to implement an event that is raised whenever text is found. FindDialogBox
implements the TextFoundEvent
for this purpose, which first requires a delegate.
Using the TextFoundEventHandler
delegate, FindDialogBox
implements the TextFoundEvent
.
Consequently, Find
can raise the event when a search result is found.
The owner window then needs to register with and handle this event.
Closing a modeless dialog box
Because DialogResult does not need to be set, a modeless dialog can be closed using system provide mechanisms, including the following:
Clicking the Close button in the title bar.
Pressing ALT+F4.
Choosing Close from the System menu.
Alternatively, your code can call Close when the Close button is clicked.
See also
-->span.sup { vertical-align:text-top; }
CLR Inside Out
Program Silverlight with the CoreCLR
Andrew Pardoe
Contents
Inside the CoreCLR Engine
The CoreCLR Security Model
The Base Class Library
Working Cross Platform
Silverlight™ 2 includes a number of changes in the Windows® Presentation Foundation (WPF) UI framework: new controls, rich networking APIs, and Digital Rights Management (DRM) support. One major change in Silverlight 2 is the ability to use Microsoft® .NET-compliant languages to program the Web client. Here I will focus on the development core of Silverlight: CoreCLR.
The past dozen or so years have given us many different Web programming technologies ranging from CSS to variants of ECMAScript. Most of them are specific to the task of Web programming—skills learned while programming CSS aren't applicable in other domains. In contrast, Silverlight 2 allows you to take the same .NET Framework skills that you use for desktop programming, such as the Base Class Libraries, XAML, and C#, and apply those skills directly to Web client applications. Moreover, we didn't have to create a separate CoreCLR development environment: you can simply use Visual Studio® to design, develop, debug and profile C# or Visual Basic® the same way you would a desktop app. We created Silverlight 2 CoreCLR precisely to make Web programming as rich as desktop programming.
While it's good for developers to have a rich programming environment, users don't want to download big browser plug-ins. In order for Silverlight to be successful with users, we had to make the installation fast. We were able to get the Beta 1 install down to 4.3MB—about 6 to 10 seconds to install over a broadband connection. This is an amazing accomplishment when you consider that the two major core pieces of the .NET Framework 2.0 CLR—mscorwks.dll and mscorlib.dll—are each about the same size as the Silverlight 2 coreclr.dll and mscorlib.dll together.
Inside the CoreCLR Engine
The design of CoreCLR began right after version 2.0 of the CLR shipped in October 2005. The two main design goals were size and compatibility: from a programmer's point of view, coding against the CLR should always be the same while from a user's point of view, the download needed to be very small. Because Silverlight is intended to target a different set of scenarios from the desktop CLR, we were able to make some changes that simplified CoreCLR and allowed us to reduce the size of the Silverlight installation. But consistency at the bottom of the stack is of key importance. Behavioral differences—even if they are correct—manifest themselves as bugs higher in the stack.
In order to ensure compatibility we used the same code for components at the bottom of the stack. The execution engine and virtual machine are the same. This includes the type system and metadata, the garbage collector (GC), the JIT compiler, and the thread pool, as well as other core parts of the runtime engine.
However, some changes were made to fit the Web application scenario. For example, because rich Internet applications are normally simple and short-running, the JIT compiler focuses on decreasing start-up time instead of performing more complex optimizations. Likewise, the server garbage-collection mode, which is tuned for multiple worker threads that use similar allocation patterns, doesn't make sense for Web-hosted applications. So Silverlight only includes the standard workstation GC, which is tuned for interactive applications. But the Microsoft intermediate language (MSIL) and metadata used in Silverlight applications is the exact same as used in managed applications for the desktop, and the behavior of your application will be consistent from the user's desktop to the browser.
The fact that Silverlight is not intended to replace the desktop CLR caused the biggest change in the core engine: CoreCLR will run side-by-side in process with the desktop CLR. In the past, we've never been able to run two versions of the CLR from within the same process. There are a few reasons this is a difficult problem. One is managing process-wide state: each instance of the CLR assumes that it's the only one in the process and thus it is the only one touching its static data. If a variable staticFoo exists in versions 1.1 and 2.0 of the CLR, and both versions of the CLR are loaded in the same process at the same time, neither version can write to the variable staticFoo without affecting the other CLR's state.
While process-wide state is the most obvious issue, other problems can result from running two CLRs side-by-side in a single process. For example, if you have two GCs running at once, how do you keep one GC from suspending the other GC's thread? Additionally, there is a problem with footprint: when you load multiple CLRs into a process they each have to load code that may be common, and they each have their own space for static variables and managed heaps.
There are some key scenarios that require the ability to host CoreCLR side-by-side with the desktop runtime. If CoreCLR and the desktop CLR couldn't run next to each other, it would be impossible to write a desktop Windows Forms or WPF app that hosts a Web Browser Control, which could navigate to a Web page that uses Silverlight. To get around this potential problem, we could have just had Silverlight depend on the CLR installed on your Windows machine: every install of Windows XP SP2 and Windows Vista® has a reasonably recent CLR installed with the OS. But having all Silverlight code run on CoreCLR guarantees absolute compatibility no matter which CLR you have installed on your machine (or in the case of Mac OS X, even if you don't have any CLR on your machine!) So we did the work to make CoreCLR run side-by-side in process with the desktop CLR, and we think that users' Silverlight experience will be much better for our efforts.
The CoreCLR Security Model
Another big change in the core engine has to do with the new security model. Note that .NET developers have traditionally used Code Access Security (CAS) to prevent untrusted code from performing privileged operations. CAS is very capable, but rather complicated. It allows the user or administrator to define various sandboxes for code using permission sets and then map individual assemblies to those sandboxes. For Silverlight applications, we just need one sandbox that's equivalent to the sandbox that Internet Explorer® uses for running script in a Web page. This simplified scenario allowed us to remove all of the CAS policy.
We also simplified the model of security enforcement. The new model is based on security transparency, a concept introduced in the version 2.0 of the CLR. At the core of the transparency model is a categorization of your code into one of three buckets: Transparent, SafeCritical, or Critical code. Transparent, the lowest trust level for code, cannot elevate privilege or access sensitive resources or information on the computer. In Silverlight 2, all application code is Transparent. Critical code, the most trusted level of code, can interact with the system through P/Invokes or even contain unverifiable code. For Silverlight 2, all Critical code must be part of the Silverlight platform. SafeCritical code, then, acts as the bridge that allows Transparent code to access system resources by calling Critical code. Think of Critical code as the kernel APIs of Windows, Transparent code as user-application code, and SafeCritical code as the API between user code and kernel code.
Transparent code can only call other Transparent or SafeCritical code. SafeCritical code can then call Critical code on behalf of the user code. It's the responsibility of SafeCritical code to canonicalize, or put into a standard format, the inputs and sanitize the outputs of the Critical code to protect the security of the system (see Figure 1).
Figure 1 Security Enforcement in the CoreCLR
The case for canonicalizing inputs to Critical code is a bit more self-evident than the case for sanitizing outputs. For example, if my Web application wants to write to a file on the local disk, it can do so using Isolated Storage. However, you don't want my application asking to write to a file named '........bootmgr,' so it's important to make sure the input is in a regular, canonical format. It's a little more unusual to think that the outputs of the Critical code are a security risk. The key security concept is that controlling disclosure of information is of great importance in reducing the overall surface area for an attacker. Say I try to access some bit of user information on your system and get the response 'permission denied.' When I repeat the same access operation, but for a different user, I get the response 'user Bob does not exist.' If I know that I get both responses I can repeatedly attempt invalid accesses to garner a list of user names on the system.
A simplified security policy is a clear win for developers working in .NET code, but it also helps developers working on .NET code. We've tried to mark as little code Critical and SafeCritical as necessary. Having most of our code be Transparent helps us to decrease the amount of code that needs in-depth security reviews. We still have to review our Transparent code for correctness and security, but at least we know it can't perform any privileged operations. Large pieces of Silverlight, including the Dynamic Language Runtime (DLR), are written entirely in Transparent code. Limiting the privileged parts of Silverlight allows us to ship a more secure product by focusing our attention on the areas that really need careful review.
Sliver
The Base Class Library
The .NET Framework has evolved on the desktop to address both user and server scenarios. Therefore, there's a lot of functionality in the Base Class Library (BCL) that doesn't make sense in Web client scenarios. For example, because Silverlight doesn't support CAS, much of System.Security is not necessary. Many other classes, like System.Console, don't make sense on the Web. (Why, then, do we include a stripped-down System.Console class? It helps us test the product.)
We had the same goal with the libraries that we had with the core engine: to pare down to the smallest set of functionality that would enable .NET developers to be successful without having to learn an entirely new technology. We garnered some inspiration and guidance from the .NET Compact Framework, which had dealt with the same problem applied to a different scenario. While trimming the BCL for Silverlight we also maintained compatibility between the .NET Compact Framework and Silverlight. Sharing a single library between all the platforms in this way maximizes the reusability of .NET skills.
There are a number of places in the BCL where you can find duplicated functionality. Sometimes the functionality is duplicated within the BCL itself—such is the case with generic collections and non-generic collections. Sometimes the functionality already exists in the base OS, as in the case of globalization support. Not only is it unnecessary to support every alternative in the Silverlight BCL, but we also can provide wins in performance and consistency by eliding this duplicated behavior.
Since we introduced support for generic collections in version 2.0 of the .Net Framework, we've been advocating that people move to generics. In version 1.x of the runtime, general-purpose data structures had to be based on objects so that the same core data structure class could be used to create collections of different types. With generic-type parameters, the compiler is able to extend these general-purpose data structures to provide type safety, making code easier to write and maintain. Additionally, generic collections generally perform better on value types than non-generic collections because there's no need to box items. Overall, generics provide all the functionality that non-generic collections provide. And because the duplication is unnecessary, we don't include non-generic collections like ArrayList in the Silverlight BCL.
Everyone is familiar with at least some of the problems of globalization: many European cultures use a comma as a decimal point; in Chinese numbers are grouped into fours (1000,0000), and so forth. The .NET Framework implements globalization functionality internally so it can work properly in multiple cultures. To do this, it includes globalization data for all supported cultures, allowing .NET–targeted applications to behave consistently across all supported versions of Windows. There are drawbacks, however. The CLR must include large data tables, and the data often becomes stale over time. In addition, the data is Windows-centric, so the data for some .NET cultures is different for the same cultures in Mac OS X. For these reasons, the CoreCLR does not include its own globalization data. Instead, System.Globalization.CultureInfo uses the globalization functionality provided by the host OS. Thus, Silverlight applications will behave more like Mac applications on Mac OS X and like Windows applications on Windows.
Overall we've tried to maintain a similar API surface area among the CLR, the .NET Compact Framework, and Silverlight, but there are other small differences scattered throughout the BCL. For example, because Silverlight has a single UI thread, it has a single Dispatcher object that holds a queue of work items for the UI. Using the Dispatcher will allow you to update the UI from a non-UI thread. This code will allow you to update a UI element—MyListBox—with a collection created on another thread (say, from a background thread):
We recommend using System.ComponentModel.BackgroundWorker in Silverlight because it encapsulates the updating of the UI on completion, but for compatibility we still include low-level threading APIs such as System.Threading.ThreadPool.QueueUserWorkItem and System.Threading.Monitor.Enter.
Like the Security Transparency model, some functionality that is new in the Silverlight BCL actually appeared in previous .NET Framework releases. A good example of this is isolated storage, which provides a virtualized file system to sandboxed applications. It's been around since the .NET Framework 1.0, but it has always addressed limited scenarios. Silverlight focuses on sandboxed applications and thus can make full use of isolated storage:
Like cookies in a Web browser, isolated storage allows Silverlight applications to maintain state across invocations. However, isolated storage offers a full virtualized file system that supports creation of directories and files. Although isolated storage is not intended for storage of high-value data such as passwords, the storage location is obfuscated and access is limited to the application that owns the store.
Quotas for isolated storage are defined by application groups, which are based on the domain name of the Silverlight application. For example, two Microsoft applications, located in directories under microsoft.com, would share an application group, meaning that both applications share the same quota. By default, an application group is given 1MB of storage.
Microsoft Silverlight Configuration Dialog Box Mac 2016
However, if an application needs additional storage space it can request a larger quota by prompting the user with a dialog box that would specify, for example, that microsoft.com wants to increase its quota to 8MB. Users can enable or disable isolated storage as well as delete current uses of it in the Silverlight configuration dialog (it is called Application Storage in the dialog). Application groups also can have shared stores, which enables related applications to share data among them.
While isolated storage has been around for some time, its uses have never been as compelling as they are with Silverlight. A configurable, secure file system for interactive Web applications allows development of traditional office applications, such as word processors, or applications that maintain large quantities of data, such as stock-tracking systems.
Microsoft Silverlight Configuration Dialog Box Mac Free
Working Cross Platform
Silverlight will run on non-Windows platforms. We have a partnership with Novell to support Linux through the Mono project's Moonlight runtime. Microsoft also is working on a version of Silverlight for the industry-leading Symbian OS and Windows Mobile®. Moonlight runs on Mono, and the mobile version of Silverlight will run on the .NET Compact Framework (which has a much lower memory footprint than CoreCLR). But the Mac OS X version of Silverlight runs on the exact same CoreCLR as on Windows.
We accomplished this with the help of a Platform Adaptation Layer (PAL). The PAL is an API written to work against different platforms. It provides abstractions for error handling, file handling, networking services, threading semantics, and so forth. Functions in the PAL share the names of Win32® APIs but differ in implementation. Some of the APIs just pass through the PAL function's parameters to an OS X function, whereas others need to use custom logic to match up OS X functionality with Windows API signatures. Some Windows functionality used by CoreCLR doesn't exist on the Mac and thus had to be implemented entirely in the PAL (see Figure 2).
Bullet
Figure 2 Platform Adaptation Layer
A lot of the Silverlight PAL benefits from lessons learned when we developed the Shared Source Common Language Infrastructure (SSCLI), also known as Rotor. The SSCLI ran on a number of UNIX-style platforms as well as Windows. The base OS functionality varies widely on UNIX-style platforms. The SSCLI PAL had to work on both microkernels (such as the Mach kernel in Mac OS X) and monolithic kernels and had to cope with different OS services such as threading, exception handling, and networking stacks. Because Silverlight only targets Windows and Intel Mac machines we were able to write Mac-specific implementations for many of the functions in the PAL, which helps with the size and performance of the PAL.
The PAL only supports the subset of Win32 necessary to enable Silverlight to run. There is no need to support the registry, GDI+, or COM. We didn't implement Windows on top of the OS X, nor did we implement enough of Windows to support the full capabilities of the desktop CLR. Limiting the PAL to support only Silverlight allows it to be small and fast.
Hiding the differences between operating systems is a tricky problem when you consider just how different OS X is from Windows. Much of OS X is written in Objective C and exposes an exception handling system which is incompatible with C++. The CLR creates I/O threads, which are separate from worker threads. These are based on I/O Completion Ports that were introduced in Windows NT® 3.5 and don't exist on OS X. Even something as simple as locating a file is different on Mac because of the backslash directory delimiter in Windows.
Throughout the design and development of the CoreCLR we've focused on providing an environment that allows developers to reuse existing skills and tools to develop rich content for a small, secure runtime. Most of our decisions were driven by the reduced scenarios of rich Internet applications, but some designs also benefited from looking at some of the work we have done in the past. Some of the decisions we made with CoreCLR will eventually make their way back into the desktop. For example, you can look forward to the next version of the desktop CLR running side-by-side in process with other versions of the CLR. Also, most of the changes made for the improved Security Transparency model will appear in our next CLR.
We carefully considered what made sense for Web-based scenarios and what didn't need to be in the runtime. We hope we've made the right choices and trust that you'll tell us how we can continue to improve. Have fun coding against Silverlight 2, and keep your eye on this space for deeper dives into CoreCLR in the future.
Send your questions and comments to clrinout@microsoft.com.
Andrew Pardoe is a program manager for CLR at Microsoft. He works on all aspects of the execution engine for both Silverlight and the desktop runtime. He can be reached at Andrew.Pardoe@microsoft.com.