This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Getting the following building with Visual Studio and Windows 10? | |
The "GenerateResource" task failed unexpectedly. | |
System.IO.FileLoadException: Could not load file or assembly 'file:///C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build.Tasks.v12.0\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Tasks.v12.0.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) | |
File name: 'file:///C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build.Tasks.v12.0\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Tasks.v12.0.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== Logging started: 1/7/2015 15:53:20 === | |
Action 15:53:20: ADMIN. | |
Action start 15:53:20: ADMIN. | |
Action 15:53:20: CostInitialize. Computing space requirements | |
Action start 15:53:20: CostInitialize. | |
Action ended 15:53:20: CostInitialize. Return value 1. | |
Action 15:53:20: FileCost. Computing space requirements | |
Action start 15:53:20: FileCost. | |
Action ended 15:53:20: FileCost. Return value 1. | |
Action 15:53:20: CostFinalize. Computing space requirements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You do not want to derive from InvalidOperationException. It and ArgumentException (and derivatives) are considered “contract breaking” exceptions. | |
Contract breaking exceptions should only be thrown to indicate that the caller has a bug. I pretend that every time I go to throw these exceptions that the process will be torn down immediately. If I’m okay with that, then I throw it, if not, then I should be throwing a different exception type. | |
Examples of contract breaks: | |
- You passed me index that was greater or equal to the number elements in the collection (returned by Count property) | |
- You passed me null, when I need a non-null value | |
- You passed me an empty string, when I need a non-empty string | |
- You called Start, but you’ve not set the ExecutablePath property. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DirectoryInfo info = new DirectoryInfo(@"C:\Temp"); | |
IEnumerable<FileInfo> files = info.EnumerateFiles("*.txt") | |
.Where(f => f.CreationTimeUtc > lastWeek); | |
foreach (FileInfo file in files) | |
{ | |
} // With your proposal, where does Dispose get called on the strong-typed enumerable returend by EnumerateFiles? |
NewerOlder