Compare commits

..
Author SHA1 Message Date
Alexander Köplinger 77769615db Fix Cairo issue on macOS Big Sur
Bumps bockbuild to get the changes from mono/bockbuild#162

BigSur's CoreGraphics seems to need a copy of the data to stick around longer than the surface,
so we provide it a copy of the data instead.

Backport of https://github.com/mono/mono/pull/20154 to 2019-12
2020-07-24 13:53:25 +02:00
Alexander Köplinger df7816daf4 Bump bockbuild to get https://github.com/mono/bockbuild/pull/159 2020-05-15 14:33:53 +02:00
Ankit Jain 5d03a6fe11 [2019-12] Bump msbuild to track mono-2019-12 (#19662)
* [2019-12] Bump msbuild to track mono-2019-12

* [2019-12] Bump msbuild to track mono-2019-12

* [2019-12] Bump msbuild to track mono-2019-12
2020-04-29 19:47:23 -04:00
Ankit Jain 4a2a26ce69 [2019-12] Bump msbuild to track mono-2019-12 (#19622)
* [2019-12] Bump msbuild to track mono-2019-12

* Bump nuget.exe to 5.6.0-preview2

* Bump roslyn to 3.6.0-4.20222.3 to match msbuild
2020-04-24 12:42:07 -04:00
monojenkins c8cfa8f284 [System.Runtime.Serialization] Work around specified cast is not valid error (#19641)
Backport of #19620.
2020-04-24 10:56:14 +02:00
Mitchell HwangandMitchell Hwang 6f0bf73005 [mono-2019-12] Bump corefx to get https://github.com/mono/corefx/pull/396 (#19428)
Co-authored-by: Mitchell Hwang <[email protected]>
2020-04-03 14:59:29 -04:00
monojenkins fdbba4a34e [2019-12] [amd64] align application stack pointer in signal handler (#19368)
[2019-12] [amd64] align application stack pointer in signal handler

16byte stack pointer alignment is only required in certain places by the ABI, so the assumption that it holds all the time is wrong (though, it passed CI 😅). We have to setup the frame properly, i.e. we have to ensure the stack pointer is properly aligned. That's what we have done previously too.

Regression of https://github.com/mono/mono/pull/17922
Fixes https://github.com/mono/mono/issues/18006


Backport of #18021.

/cc @lewurm
2020-04-03 06:36:06 -04:00
Alexander Köplinger 1278c2f35e Bump bockbuild to get PATH fix 2020-04-03 11:36:20 +02:00
8199a27e28 [2019-12] Force Python 3.x from env in shebang lines (#19423)
* Force Python 3.x from env in shebang lines

* Fix byte/string incompatiblity in Python 3

* Fix locating Python interpreter when it isn't "python" (#18197)

Fix locating Python interpreter when it isn't "python"

The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.

This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.

(cherry picked from commit 84221f04b5)

* More disambiguation of Python in makefiles (#18284)

(cherry picked from commit b3ce5bfa88)

* [build] Check for Python 3 in configure.ac (#18625)

I fear this causing packaging problems, but as-is we require Python 3 for most of our Python files but don't actually check for that in configure. We should be consistent about this. Some projects (notably wasm) also use the Python version detected here, so bumping this will also bump the version used in those cases (a good thing, since there are some known bugs when using the scripts with Python 2).

(cherry picked from commit 0f47ea5d80)

Co-authored-by: Calvin Buckley <[email protected]>
Co-authored-by: Ryan Lucia <[email protected]>
2020-04-03 10:38:34 +02:00
Alexander Köplinger 9b3e6f4700 Fix Windows .msi build using newer xar and recent cygwin updates
The old version didn't compile anymore with OpenSSL 1.1

Cygwin now ships libssl 1.1 which removed OpenSSL_add_all_ciphers so the xar configure fails.
Replace the configure check with another existing function to fix it.

(cherry picked from commit 9485a66d20)
(cherry picked from commit e10990125d)
2020-04-03 10:37:58 +02:00
monojenkinsandAlexis Christoforides 8487188883 [2019-12] [merp] Add breadcrumb for StackHash (#19243)
* [merp] Add breadcrumb for StackHash

Contributes to https://github.com/mono/mono/issues/18715

Co-authored-by: Alexis Christoforides <[email protected]>
2020-03-17 11:59:07 -04:00
monojenkinsandAleksey Kliger f2379f2d66 [2019-12] [corlib] Capture the ExceptionDispatchInfo when rethrowing from TaskContinuation (#19208)
* [corlib] Capture the ExceptionDispatchInfo when rethrowing from TaskContinuation

In `task.GetAwaiter().OnCompleted(action)` if `action` throws, the
`TaskContinuation.RunOrScheduleAction method will catch the exception and then
call `RuntimeAugments.ReportUnhandledException`.  We must not simply throw the
exception again - in that case we will lose all the frames leading up to the
`catch` in `RunOrScheduleAction`.  Instead use ExceptionDispatchInfo to
caputure the original throw.

Addresses https://github.com/mono/mono/issues/19166

* [test] Add regression test

For annoying reasons we can't run this as a simple NUnit test because the
exception is unhandled on some arbitrary threadpool worker thread, and those
don't show up within an NUnit setup.

Additionally because the unhandled exception in the root domain would normally
terminate the application, we need to run this in a new appdomain.

Co-authored-by: Aleksey Kliger <[email protected]>
2020-03-13 10:03:05 -04:00
Ankit Jain db04a05e04 [2019-12] Bump msbuild to track mono-2019-12 (#19205) 2020-03-12 23:39:03 +01:00
monojenkinsandAlexis Christoforides d06686c425 [merp] Create a 'reason' breadcrumb for the crash dump process (#19119)
For example, the system name of a signal ('segv') or 'MANAGED_EXCEPTION' are typical arguments.

Co-authored-by: Alexis Christoforides <[email protected]>
2020-03-11 09:35:31 -04:00
Ankit Jain 2ff898859b [2019-12] Bump msbuild to track mono-2019-12 (#19078) 2020-03-02 20:49:30 +01:00
Alexander Köplinger b27b2d7f61 Update mono-extensions 2020-02-28 19:58:45 +01:00
Alexander Köplinger 13fc6948f3 Update mono-extensions 2020-02-28 19:06:21 +01:00
Alexander Köplinger 2517534847 Bump mono-extensions 2020-02-28 15:22:33 +01:00
Alexis Christoforides c6890f410c [2019-12][runtime] Improve handling crashing signals (#19018)
* [runtime] Improve handling crashing signals

The default handlers for SIGTRAP, SIGSYS on macOS and Linux crash the process, so we now have Mono report this.

This patch also changes how the name of the signal is acquired for passing on to the crash reporting functions, allowing code reuse on crashing signals.

* [mono] Remove SIGTRAP handler, as it interferes with debugging

See https://github.com/mono/mono/pull/18243#issuecomment-586013427

* Fix lack of cleanup for SIGSYS
2020-02-28 02:27:41 -05:00
monojenkinsandThays Grazia b33fa1d00e Backport 2020-02 enable embedded ppdb. (#19050)
Co-authored-by: Thays Grazia <[email protected]>
2020-02-26 20:10:15 -05:00
Alexander Köplinger 8a687a4044 Bump bockbuild for Pango nil check fix
Pango nil check fix: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1069059/

Brings in https://github.com/mono/bockbuild/pull/153

Backport of https://github.com/mono/mono/pull/18936
2020-02-24 19:48:37 +01:00
monojenkinsandAlexis Christoforides 44703b3ecc [merp] Produce hashes for unmanaged thread stacks also (#18964)
Before, this was only done for managed stacks.

Addresses https://github.com/mono/mono/issues/18941

Co-authored-by: Alexis Christoforides <[email protected]>
2020-02-24 13:01:47 -05:00
monojenkinsandAlexis Christoforides 0ac7105edd [merp] Increase buffer size for state dump (#18839)
Addresses https://github.com/mono/mono/issues/18796

Co-authored-by: Alexis Christoforides <[email protected]>
2020-02-24 10:21:43 -05:00
Ankit Jain 147ecc0ac3 [2019-12] Bump msbuild to track mono-2019-10 (#18986) 2020-02-24 15:51:06 +01:00
monojenkinsandNathan Ricci e7b4669bc9 Added some parenthesis and a cast to control order of operations. (#18984)
This fixes https://github.com/mono/mono/issues/17140; intermittent incorrect results from GetTotalBytesAllocated for current thread. uint64_t and a pointer difference are not the same type/width on all architectures, so incorrect results can happen with out the parenthesis.

Co-authored-by: Nathan Ricci <[email protected]>
2020-02-24 12:08:03 +01:00
monojenkinsandVlad Brezae fc145be98c [sgen] Disable managed allocator when using nursery-canaries (#18946)
The managed allocator included in a full aot image does not support canaries, leading to inconsistent object layout.

Fixes https://github.com/mono/mono/issues/18925

Co-authored-by: Vlad Brezae <[email protected]>
2020-02-20 14:01:06 +02:00
monojenkinsandEgor Bogatov adebac056a Remove TestEnvVarSwitchForInnerHttpHandler test as it should be in XA/LinkerTests.cs instead (#18956)
Co-authored-by: Egor Bogatov <[email protected]>
2020-02-20 11:11:33 +01:00
monojenkinsandAleksey Kliger f7f561703a [2019-12] [merp] Capture Environment.FailFast message in crash report (#18921)
* [merp] Capture Environment.FailFast message in crash report

* [test] merp-crash-test refactor crasher data; add optional validator

Switch from a Tuple<T1,T2> to a struct for the crash items.  Add a third
optional validator field which is an action to run on the json blob that we get
back.

Not updating existing tests to do any json validation, yet.

* [test] Add new MERP crash test for Environment.FailFast

Check that the resulting json blob includes the failfast message.

Co-authored-by: Aleksey Kliger (λgeek) <[email protected]>
2020-02-19 20:16:29 +01:00
monojenkins b5b50eefe7 [2019-12] [bcl] Default XmlSerializer stream serialize to UTF8 Encoding (#18908)
* [mcs] Default XmlSerializer stream serialize to UTF8 Encoding

* [bcl] Add XmlSerialize Test to preserve UTF chars in stream
2020-02-19 14:06:28 -05:00
Marius Ungureanu cec38fcfc8 Bump bockbuild to bring in Gtk# regression fix (#18911)
Backport of https://github.com/mono/mono/pull/18909
2020-02-18 19:45:45 +01:00
monojenkinsandEgor Bogatov 0761b0ee55 [2019-12] Make MonoWebRequestHandler linker friendly (#18833)
* Make MonoWebRequestHandler linker friendly

* Make MonoWebRequestHandler's ctor public (to be able to use in Activator.CreateInstance without binding flags)

* Remove Console.WriteLine from system.net.http

Co-authored-by: Egor Bogatov <[email protected]>
2020-02-18 15:55:00 +03:00
monojenkinsandEgor Bogatov 0c45a74a96 Move HttpClientHandlerTests.Android.cs to nunit (#18889)
Co-authored-by: Egor Bogatov <[email protected]>
2020-02-18 15:54:41 +03:00
Ankit Jain d5f5f3762f [2019-12] Bump msbuild to track mono-2019-10 (#18862)
- Changes roslyn to 3.5.0-beta2-20074-05
2020-02-17 12:39:58 +01:00
monojenkinsandAlexander Köplinger f1bdf8a93d Move offsets-tool into mono/tools (#18830)
Backporting this since we see errors during `pip install` on the Android Mono SDKs build on Linux and with this we're removing the call to pip (it wasn't needed).

Backport of #18783.

Co-authored-by: Alexander Köplinger <[email protected]>
2020-02-13 14:16:59 +01:00
Ankit Jain 3fdc3c84b2 [2019-12] Bump msbuild to track mono-2019-10 (#18792)
* [2019-12] Bump msbuild to track mono-2019-10

* Bump roslyn to 3.5.0-beta3-20111-03 .

* Update nuget.exe to match xbuild

- the closest version available right now, to `5.5.0-rtm.6422` is
`5.5.0-preview2`, so using that for now.
2020-02-12 17:11:04 +01:00
monojenkins 846a5d41ee [2019-12] Allow users to switch to MonoWebRequestHandler on Android via UI (#18786)
* Bring back old HttpHandler for Android
Co-authored-by: Egor Bogatov <[email protected]>
2020-02-12 16:24:10 +03:00
Alexander Köplinger c8b96661d3 Bump bockbuild to get GTK NSPasteboardType change.
Backport from https://github.com/mono/mono/pull/18080
2020-02-10 16:22:27 +01:00
monojenkinsandAlex Soto db584480ff [iOS] Replace removed dsymutil -t switch with -num-threads (#18744)
Apple removed `-t` switch from dsymutil in favor of `-num-threads`

Co-authored-by: Alex Soto <[email protected]>
2020-02-07 11:14:01 +01:00
Alexander Köplinger 0686e1435b Skip WebAssembly build in sdks archive build on non-master branches
WebAssembly doesn't use our usual release branches yet.

(cherry picked from commit a40e1ae681)
2020-02-06 22:39:13 +01:00
monojenkinsandAlexis Christoforides 5ef6ad0ef7 [merp] Add an exception type for managed exceptions (#18723)
Addresses https://github.com/mono/mono/issues/18681

Co-authored-by: Alexis Christoforides <[email protected]>
2020-02-06 16:31:17 -05:00
monojenkinsandManuel de la Pena 36073a0c74 [NUnitLite] Bump nunitlite submodule. (#18733)
Update the nunitlite submodule to pick up some fixes in the NUnit v3
outputwriter that are needed by xamarin-macios.

Co-authored-by: Manuel de la Pena <[email protected]>
2020-02-06 15:57:58 +01:00
Matt Sylvia e65846bfd3 Update deprecated query parameter to header (#18705)
Use of `access_token` is now deprecated, switching to HTTP header

```
Please use the Authorization HTTP header instead, as using the `access_token` query parameter is deprecated.
```

(cherry picked from commit 2f74ab393f)
2020-02-04 22:58:48 +01:00
monojenkinsandZoltan Varga 0011444f0b [aot] Avoid inflating gparams with byreflike types during generic sharing. (#18682)
Fixes https://github.com/mono/mono/issues/18676.

Co-authored-by: Zoltan Varga <[email protected]>
2020-02-04 16:41:04 +01:00
monojenkinsandAleksey Kliger 4c93e382f5 [2019-12] [merp] MONO_DEBUG=no-gdb-stacktrace shouldn't disable MERP (#18611)
* [merp] MONO_DEBUG=no-gdb-stacktrace shouldn't disable MERP

Only prevent `gdb` or `lldb` from being invoked.

MERP is controlled by separate mechanisms --- configure flags for crash
reporting and an explicit opt-in icall.

The existing code collects crashed process data in-process, but it writes the
data out (using mono_merp_invoke) in the forked child process.  This is a bit
surprising, but in the interest of not disturbing the code too much, this PR
doesn't change that.  We should revisit `dump_native_stacktrace` again in the
future and rationalize these decisions.

Addresses https://github.com/mono/mono/issues/18565

* Fix indentation

Co-authored-by: Aleksey Kliger (λgeek) <[email protected]>
2020-01-31 19:24:43 +01:00
monojenkinsandAlexander Köplinger 8b72dbb708 [corlib] Split corlib xunit tests even more for iOS (#18620)
Follow-up to https://github.com/mono/mono/pull/18228 since two parts wasn't enough to fix the size issue on 32bits devices.
We now use three parts.

Fixes https://github.com/mono/mono/issues/18614

Co-authored-by: Alexander Köplinger <[email protected]>
2020-01-29 21:27:54 +01:00
Alexander Köplinger 1e2d68b92c Bump bockbuild for Pango patch
Fixes bug #1048838, correct SF font not loading in VSMac

Backport of https://github.com/mono/mono/pull/18566
2020-01-28 13:16:07 +01:00
monojenkinsandAlexander Köplinger e55302cb08 configure.ac: remove AC_SEARCH_LIBS for libintl (#18595)
This causes an additional dependency of mono on libintl which we didn't have before.
Reported by a user on gitter, it's problematic on macOS since it makes the mono binary depend on the libintl we ship in the Mono .pkg.

It was introduced in Mono 6.6 by https://github.com/mono/mono/commit/18e0ebfe89be0a175d2f904b9bb1ec6816daa318

Co-authored-by: Alexander Köplinger <[email protected]>
2020-01-27 17:02:44 +01:00
monojenkins ef8188a08d [runtime] Disable lldb backtrace display on osx, it hangs on attaching in lldb. (#18591)
Backport of #18590.
Co-authored-by: Zoltan Varga <[email protected]>
2020-01-27 10:59:17 +01:00
Ankit Jain 01be275ad7 [2019-12] Bump msbuild to track mono-2019-10 (#18577) 2020-01-27 10:55:09 +01:00
monojenkinsandZoltan Varga f9e5a6d2b2 [jit] Compute has_references correctly for gshared types whose constraint is a generic valuetype. Also emit write barriers correctly for these types. (#18562)
Co-authored-by: Zoltan Varga <[email protected]>
2020-01-25 13:02:39 -05:00
monojenkinsandThays Grazia a979811c63 [2019-12] [debugger] Native thread not executing managed code considered as terminated (#18504)
* If a thread was suspended and doesn't have any managed stack, it was considered as terminated, but it wasn't really terminated because it can execute managed code again, and stop in a breakpoint so if the execution arrives in debugger_agent_breakpoint_from_context we reset the flag terminated to FALSE.

* Adding terminated = FALSE in single_step_from_context.

Co-authored-by: Thays Grazia <[email protected]>
2020-01-23 13:15:06 -03:00
monojenkinsandBernhard Urban-Forster 455cf7d3b1 [interp] context can be uninitialized for get_resume_state callback (#18535)
`jit_tls->interp_context` gets initialized lazily, that is, upon the first interpreter execution on a specific thread (e.g. via interp_runtime_invoke). However, with mixed mode the execution can purely happen in AOT code upon the first interaction with the managed debugger.

Stack trace:

```
  thread #1, name = 'tid_407', queue = 'com.apple.main-thread'
    frame #0: 0x0000000190aedc94 libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x0000000190a0f094 libsystem_pthread.dylib`_pthread_cond_wait$VARIANT$armv81 + 672
    frame #2: 0x000000010431318c reloadcontext.iOS`mono_os_cond_wait(cond=0x0000000104b9ba78, mutex=0x0000000104b9ba30) at mono-os-mutex.h:219:8
    frame #3: 0x0000000104312a68 reloadcontext.iOS`mono_coop_cond_wait(cond=0x0000000104b9ba78, mutex=0x0000000104b9ba30) at mono-coop-mutex.h:91:2
    frame #4: 0x0000000104312858 reloadcontext.iOS`suspend_current at debugger-agent.c:3021:4
    frame #5: 0x000000010431be18 reloadcontext.iOS`process_event(event=EVENT_KIND_BREAKPOINT, arg=0x0000000145d09ae8, il_offset=0, ctx=0x0000000149015c20, events=0x0000000000000000, suspend_policy=2) at debugger-agent.c:4058:3
    frame #6: 0x0000000104310cf4 reloadcontext.iOS`process_breakpoint_events(_evts=0x000000028351a680, method=0x0000000145d09ae8, ctx=0x0000000149015c20, il_offset=0) at debugger-agent.c:4722:3
    frame #7: 0x000000010432f1c8 reloadcontext.iOS`mono_de_process_breakpoint(void_tls=0x0000000149014e00, from_signal=0) at debugger-engine.c:1141:2
    frame #8: 0x000000010430f238 reloadcontext.iOS`debugger_agent_breakpoint_from_context(ctx=0x000000016f656790) at debugger-agent.c:4938:2
    frame #9: 0x00000001011b73a4 reloadcontext.iOS`sdb_breakpoint_trampoline + 148
    frame #10: 0x00000001008511b4 reloadcontext.iOS`reloadcontext_iOS_Application_Main_string__(args=0x000000010703a030) at Main.cs:14
    frame #11: 0x00000001010f9730 reloadcontext.iOS`wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 272
    frame #12: 0x00000001042fd8b8 reloadcontext.iOS`mono_jit_runtime_invoke(method=0x0000000145d09ae8, obj=0x0000000000000000, params=0x000000016f656f20, exc=0x0000000000000000, error=0x000000016f656ff8) at mini-runtime.c:3162:3
    frame #13: 0x0000000104411950 reloadcontext.iOS`do_runtime_invoke(method=0x0000000145d09ae8, obj=0x0000000000000000, params=0x000000016f656f20, exc=0x0000000000000000, error=0x000000016f656ff8) at object.c:3052:11
    frame #14: 0x000000010440c4dc reloadcontext.iOS`mono_runtime_invoke_checked(method=0x0000000145d09ae8, obj=0x0000000000000000, params=0x000000016f656f20, error=0x000000016f656ff8) at object.c:3220:9
    frame #15: 0x0000000104415ae0 reloadcontext.iOS`do_exec_main_checked(method=0x0000000145d09ae8, args=0x000000010703a030, error=0x000000016f656ff8) at object.c:5184:3
    frame #16: 0x00000001044144ac reloadcontext.iOS`mono_runtime_exec_main_checked(method=0x0000000145d09ae8, args=0x000000010703a030, error=0x000000016f656ff8) at object.c:5281:9
    frame #17: 0x0000000104414500 reloadcontext.iOS`mono_runtime_run_main_checked(method=0x0000000145d09ae8, argc=1, argv=0x000000016f6570d0, error=0x000000016f656ff8) at object.c:4734:9
    frame #18: 0x00000001042d3b54 reloadcontext.iOS`mono_jit_exec_internal(domain=0x0000000145f00130, assembly=0x0000000281ba2900, argc=1, argv=0x000000016f6570d0) at driver.c:1320:13
    frame #19: 0x00000001042d39a4 reloadcontext.iOS`mono_jit_exec(domain=0x0000000145f00130, assembly=0x0000000281ba2900, argc=1, argv=0x000000016f6570d0) at driver.c:1265:7
    frame #20: 0x0000000104597994 reloadcontext.iOS`::xamarin_main(argc=5, argv=0x000000016f657a80, launch_mode=XamarinLaunchModeApp) at monotouch-main.m:483:8
    frame #21: 0x00000001008510dc reloadcontext.iOS`main(argc=5, argv=0x000000016f657a80) at main.m:104:11
    frame #22: 0x0000000190af8360 libdyld.dylib`start + 4
[...]
* thread #5, name = 'Debugger agent', stop reason = signal SIGABRT
  * frame #0: 0x0000000190aedec4 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x0000000190a0d724 libsystem_pthread.dylib`pthread_kill$VARIANT$armv81 + 216
    frame #2: 0x000000019095d844 libsystem_c.dylib`abort + 100
    frame #3: 0x00000001045871b4 reloadcontext.iOS`log_callback(log_domain=0x0000000000000000, log_level="error", message="* Assertion at ../../../../../mono/mini/interp/interp.c:7176, condition `context' not met\n", fatal=4, user_data=0x0000000000000000) at runtime.m:1213:3
    frame #4: 0x0000000104544fc8 reloadcontext.iOS`eglib_log_adapter(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, message="* Assertion at ../../../../../mono/mini/interp/interp.c:7176, condition `context' not met\n", user_data=0x0000000000000000) at mono-logger.c:405:2
    frame #5: 0x000000010456093c reloadcontext.iOS`monoeg_g_logstr(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, msg="* Assertion at ../../../../../mono/mini/interp/interp.c:7176, condition `context' not met\n") at goutput.c:134:2
    frame #6: 0x0000000104560598 reloadcontext.iOS`monoeg_g_logv_nofree(log_domain=0x0000000000000000, log_level=G_LOG_LEVEL_ERROR, format="* Assertion at %s:%d, condition `%s' not met\n", args="e\x12z\x04\x01") at goutput.c:149:2
    frame #7: 0x000000010456061c reloadcontext.iOS`monoeg_assertion_message(format="* Assertion at %s:%d, condition `%s' not met\n") at goutput.c:184:22
    frame #8: 0x0000000104560674 reloadcontext.iOS`mono_assertion_message(file="../../../../../mono/mini/interp/interp.c", line=7176, condition="context") at goutput.c:203:2
    frame #9: 0x000000010459b570 reloadcontext.iOS`interp_get_resume_state(jit_tls=0x000000014900d000, has_resume_state=0x000000016fc7a9f4, interp_frame=0x000000016fc7a9e8, handler_ip=0x000000016fc7a9e0) at interp.c:7176:2
    frame #10: 0x0000000104319420 reloadcontext.iOS`compute_frame_info(thread=0x0000000104fe4130, tls=0x0000000149014e00, force_update=1) at debugger-agent.c:3422:3
    frame #11: 0x0000000104320d40 reloadcontext.iOS`thread_commands(command=1, p="", end="", buf=0x000000016fc7acf8) at debugger-agent.c:9048:3
    frame #12: 0x000000010431cca0 reloadcontext.iOS`debugger_thread(arg=0x0000000000000000) at debugger-agent.c:10132:10
    frame #13: 0x000000010447eb04 reloadcontext.iOS`start_wrapper_internal(start_info=0x0000000000000000, stack_ptr=0x000000016fc7b000) at threads.c:1232:3
    frame #14: 0x000000010447e788 reloadcontext.iOS`start_wrapper(data=0x000000028203ef40) at threads.c:1305:8
    frame #15: 0x0000000190a11d8c libsystem_pthread.dylib`_pthread_start + 15
[...]
```

Thanks to @drasticactions for helping me to reproduce.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1050615

Co-authored-by: Bernhard Urban-Forster <[email protected]>
2020-01-23 13:50:12 +01:00
2edccc52a7 [2019-12] [jit] Compute the instance size/alignment correctly for gshared types whose constraint is a generic valuetype. (#18529)
* [jit] Compute the instance size/alignment correctly for gshared types whose constraint is a generic valuetype.

Fixes https://github.com/mono/mono/issues/18455.

* [jit] Simplify code

Fix some line damage

Co-authored-by: Zoltan Varga <[email protected]>
Co-authored-by: Vlad Brezae <[email protected]>
2020-01-21 15:05:07 -08:00
monojenkinsandAlexander Köplinger 2b0e9bfe7a Bump xsp to fix issues with removed Mono.Security APIs (#18487)
See https://github.com/mono/xsp/pull/88

Co-authored-by: Alexander Köplinger <[email protected]>
2020-01-16 21:51:57 +01:00
monojenkinsandJo Shields d56ea8a520 [2019-12] Don't run make install in boehm submodule (#18476)
* Don't run `make install` in boehm submodule

* Simplify logic

Co-authored-by: Jo Shields <[email protected]>
2020-01-16 10:35:01 -05:00
monojenkins 4e15267c70 [wasm] Improve virtualenv installation script (#18470)
[2019-12] [wasm] Improve virtualenv installation script



Backport of #18190.

/cc @lewurm @marek-safar
2020-01-16 12:36:02 +01:00
monojenkinsandBernhard Urban-Forster fe455fcb34 [2019-12] [arm] account for signed bit when calculating offset to PLT entry (#18460)
* [arm] account for signed bit when calculating offset to PLT entry

* mask only will do the job

Co-authored-by: Bernhard Urban-Forster <[email protected]>
2020-01-16 10:47:32 +01:00
monojenkinsandAleksey Kliger 64bfc6c000 [2019-12] [loader] ReflectionOnlyLoad(byte[]) should not apply binding redirects (#18458)
* [loader] ReflectionOnlyLoad(byte[]) should not apply binding redirects

Match .NET Framework behavior.

Addresses https://github.com/mono/mono/issues/18388

* [tests] ReflectionOnlyLoad(byte[]) should not apply binding redirects

Regression test for https://github.com/mono/mono/issues/18388

Co-authored-by: Aleksey Kliger (λgeek) <[email protected]>
2020-01-15 10:47:39 +01:00
monojenkinsandVlad Brezae 0fd24828b1 [2019-12] [sgen] Fixes for max-heap-size option (#18456)
* [sgen] Don't subtract twice the nursery size from max_heap_size

We were subtracting the nursery size when initializing max_heap_size as well as adding it to the allocated_heap when allocating the nursery (alloc_nursery).

* [sgen] Trigger collection if failing to allocate los section

If the memory governor says we are exceeding the max_heap_size by allocating a los section (1MB) for a new los object, attempt to clear some space by triggering a major collection, before completely bailing out.

Co-authored-by: Vlad Brezae <[email protected]>
2020-01-15 10:45:09 +01:00
Ankit Jain 03e8e8e56f [2019-12] Bump msbuild to track mono-2019-10 (#18433) 2020-01-12 10:55:59 +01:00
Ankit Jain db8ee7ad92 [2019-12] Bump msbuild to track mono-2019-10 (#18413) 2020-01-10 12:43:06 +01:00
monojenkins a83bdec08e [memory barrier] use pagesize determined by helper (#18396)
[2019-12] [memory barrier] use pagesize determined by helper

`limits.h` doesn't always define `PAGESIZE` properly (e.g. iOS), so it would fall back to `0x1000` (4096) but it's really `0x4000` (16384) on iOS. We already have a helper in the runtime to determine the pagesize, so let's use that instead.


Fixes https://github.com/mono/mono/issues/18273

Backport of #18383.

/cc @lewurm
2020-01-10 01:55:45 +01:00
Martin BauligandAlexander Köplinger f323b29968 Bump corefx to latest 2019-12. (#18405)
Co-authored-by: Alexander Köplinger <[email protected]>
2020-01-09 23:48:02 +01:00
Alexis Christoforides 360e64d261 [FileSystemWatcher] Fix wrong behaviour when move multiple files out of watched folder on mac (#41963) (#18225)
Backport of https://github.com/dotnet/corefx/pull/41963

Fixes https://github.com/mono/mono/issues/16778
2020-01-09 16:24:33 -05:00
Ankit Jain a1351981f6 [2019-12] Bump msbuild to track mono-2019-10 (#18392) 2020-01-09 22:18:30 +01:00
monojenkinsandRyan Lucia 2cc08cae73 [reflection] Fix check for Type.FullName to match CoreCLR (#18390)
Updated test to follow in dotnet/runtime

Co-authored-by: Ryan Lucia <[email protected]>
2020-01-09 11:12:27 -05:00
Ankit Jain 0a51d89c42 [2019-12] Bump msbuild to track mono-2019-10 (#18375) 2020-01-08 15:00:40 +01:00
monojenkins f7df632ff0 [2019-12] [jit] Avoid passing a vtable argument to DIM methods when making calls out of gsharedvt methods. (#18365)
* [jit] Avoid passing a vtable argument to DIM methods when making calls out of gsharedvt methods.

Fixes https://github.com/mono/mono/issues/18276.
2020-01-07 17:28:27 -05:00
Ankit Jain 694c3ef470 [2019-12] Bump msbuild to track mono-2019-10 (#18304) 2020-01-07 18:10:27 +01:00
monojenkins 00cb738f63 [2019-12] Add SignedCms to the TypeForwards in the System.Security.Cryptography.Pkcs facade (#18362)
* Add SignedCms to the typeforwards in the System.Security.Cryptography.Pkcs facade

* Added additional missing types from System.Security.Cryptography.Pkcs.

* It would be nice if the files I added had namespaces ;-)

* [csproj] Update project files

* Bump API snapshot submodule
2020-01-07 18:05:54 +01:00
monojenkins 1ff24a77be [2019-12] [metadata] Size 0 Blob heap is ok when resolving assembly refs (#18337)
* [metadata] Size 0 Blob heap is ok when resolving assembly refs

Sometimes ILasm can produce images with a Blob heap of size 0.  In cases where
we're loading assembly references from such an image, the hash (which is
optional) can be at index = 0 and the Blob heap size is also 0.

Also: add the hash value to the output of `monodis --assemblyref`

* [metadata] Add a separate assertion for the index == size == 0 case

And a comment explaining how it is likely to be triggered.  If the assembly is
reasonable the caller of mono_metadata_blob_heap should be updated to use
mono_metadata_blob_heap_null_ok instead

* [bcl] Allow Mono's ILASM to produce a size 0 Blob heap

ECMA 335 II.24.2.4 says that the user string and blob heaps should have an
entry at index 0 consisting of the single byte 0.  However .NET Framework (and
.NET Core) ilasm will entirely omit the Blob heap (that is, create a blob heap
entry of size 0) if it is not needed.  This PR changes Mono's ILASM to emit the
initial byte on demand only if one of the MetaDataStream.Add() methods is
called. Otherwise we will also emit a stream of size 0.

This is needed to compile some test cases.

* [tests] Add regression test for loading assemblies with size 0 Blob heap

Depends on ILASM that can emit a size 0 Blob heap
2020-01-06 16:02:33 -05:00
monojenkins 5f80ec8d77 [2019-12] Set inited flag _after_ TermInfoDriver initialisation completes (#18329)
[2019-12] Set inited flag _after_ TermInfoDriver initialisation completes

This flag was causing issues when accessing console properties on concurrent threads during TermInfoDriver initialisation.

Fixes #18317

Backport of #18318.

/cc @steveisok @nagytech
2020-01-03 20:36:17 +01:00
Steve Pfister 1ae385b59e [2019-12] Pull in DirectoryInfo Invalidate After Create Fix (#18327)
* Bump to mono/corefx@b7e7440

Backport of https://github.com/mono/mono/pull/18310

* Forgot the test tweak
2020-01-03 12:27:42 -05:00
monojenkinsandThays Grazia b61db514ab The behaviour expected of filter exceptions is: -> throw in a async task with a try catch in the caller -> don't stop -> throw in a new thread with a try catch in the caller -> stop -> throw in the main thread without any try catch -> stop (#18333)
Including a new test to test the fix of #17601.

Fixing #16588, create a while 1 to stops the program execution when an exception is thrown and no try catch is found and MONO_DEBUG=suspend-on-unhandled.

Fixes #17601
Fixes #16588

Co-authored-by: Thays Grazia <[email protected]>
2020-01-03 10:21:35 -03:00
monojenkins 68a4b43536 Use byte-aligned LLVM loads and stores for unaligned mini IR loads and stores. (#18301)
[2019-12] Use byte-aligned LLVM loads and stores for unaligned mini IR loads and stores.

Should fix https://github.com/mono/mono/issues/18221.

Backport of #18296.

/cc @lambdageek @imhameed
2020-01-02 22:16:13 +01:00
monojenkinsandMartin Baulig a36cb75039 Socket.BeginMConnect() should not attempt connections on unsupported address families. (#18322)
Fixes #16513.

Co-authored-by: Martin Baulig <[email protected]>
2020-01-01 17:31:23 -05:00
monojenkinsandAleksey Kliger c721d4ce2a [eglib] Don't define _FORTIFY_SOURCE on Cygwin builds (#18311)
See https://github.com/msys2/MINGW-packages/issues/5803

Without -lssp (or -fstack-protector), -D_FORTIFY_SOURCE=2 leads to linker
errors.

Co-authored-by: Aleksey Kliger (λgeek) <[email protected]>
2019-12-30 09:54:18 -05:00
Ankit Jain 2c3a70016b [2019-12] Bump msbuild to track mono-2019-10 (#18258)
* Bump msbuild to track mono-2019-10

- and update nuget.exe to 5.5.0-preview1 to match

* [2019-12] Bump msbuild to track mono-2019-10
2019-12-24 18:36:25 -05:00
monojenkins cafdade424 [domain] Don't add NULL runtime to runtimes list (#18266)
Also when iterating over the runtimes, actually look at the current element,
not the first element.

Also mention the unsupported runtime version in the warning message when it is
passed to mono_init_internal.

Fixes https://github.com/mono/mono/issues/17916
2019-12-23 08:42:29 -05:00
Alexander Köplinger 43cfe8ecfe Bump corefx to get test fix 2019-12-20 00:37:02 +01:00
Alexander Köplinger bcee9454e9 [System] Add additional hardening against race in MonoTlsStream (#18250)
See https://github.com/mono/mono/issues/15805#issuecomment-567131297

(cherry picked from commit c8e19bec68)
2019-12-19 11:57:43 +01:00
Alexander Köplinger e283c45cc0 [bcl] Split corlib and System.Core xunit test assemblies for monotouch profiles (#18228)
They cannot deal with large test assemblies so we need to split them.

We're doing this by introducing a new `#skip <PROFILE>` directive in the .sources format which defines where to split the assembly.
The logic is very simple: files up until the first `#skip` are common files which get included in each part, subsequent files are only in the respective part assembly.

Fixes https://github.com/mono/mono/issues/18213

(cherry picked from commit 3891fe97d2)
(cherry picked from commit a74416d950)
2019-12-18 22:23:03 +01:00
Ankit Jain 828af02bdf Bump msbuild to track mono-2019-10 (#18193)
.. to get changes from https://github.com/mono/msbuild/pull/184 .
2019-12-18 16:48:30 +01:00
monojenkins ff68a657fa [metadata] Check for GTDs in setup_generic_array_ifaces (#18216)
Judging by https://github.com/mono/mono/blob/4cefdcb7ce2d939ee78fb45d1b4913eb3bc064fd/mono/metadata/metadata.c#L3515 the cached_class is sometimes intentionally a GTD, which can get passed all the way down to setup_generic_array_ifaces and cause a crash.
2019-12-17 14:14:03 -05:00
monojenkins eb6a6bae1e [2019-12] [cominterop] Attach to runtime from IUnknown and IDispatch methods (#18185)
* [cominterop][test] Calling QueryInterface from an unattached thread asserts

If we pass a managed COM object to native code and the native code calls one of
the IUnknown methods, we assert because the thread is not attached but we want
to enter GC Unsafe mode.

* [cominterop] Attach to runtime from IUnkown and IDispatch methods

If the COM objects for a managed object is passed to a thread that hasn't
interacted with Mono before, we need to attach before doing GC thread state
transitions.

Addresses https://github.com/mono/mono/issues/18137

* [test] Call managed method through COM wrapper from unattached thread

This works, but I don't think we had a test previously.  Call a managed method
via a COM interface from a thread that is not attached to the runtime, to
ensure that it is attached.
2019-12-16 11:08:09 -05:00
monojenkins e8046e3848 [2019-12] Relax faultcode parsing for Soap11 message errors. (#18187)
* Relax faultcode parsing for Soap11 message errors.

The mono implementation was reading the faultcode content as an XmlQualifiedName, which applied the rule where you could not
start a name with a number. This caused interoperability problems with the .net framework because their parsing just looks
for <namespace>:<name>, where name can be any string.

Example:

<faultcode>s:1</faultcode>

On mono, a soap response that contains a fault code name of 1 will throw an error.  If you run the same code on the .net framework, it will not.

Fixes https://github.com/mono/mono/issues/12995

* [csproj] Update project files
2019-12-14 00:32:18 +01:00
Alexander Köplinger ade2f9239a [sdks] Use Xcode 11.3 stable version for iOS/Mac SDKs
As requested by the xamarin-macios team.

(cherry picked from commit 7e65a73d4d)
2019-12-13 18:15:41 +01:00
Ankit Jain ac8a9a9eab [2019-12] Bump msbuild to track mono-2019-10 (#18131)
* Bump msbuild to track mono-2019-10

- msbuild doesn't have a separate branch for mono-2019-12 right now

* [2019-12] Bump msbuild to track mono-2019-10

* [2019-12] Bump msbuild to track mono-2019-10
2019-12-12 20:57:10 -05:00
monojenkins 12c92be908 [corlib] Rename internal LogLevel enum to avoid conflict with Android LogLevel (#18125)
After https://github.com/mono/mono/pull/18040 we now have InternalsVisibleTo for the Mono.Android assembly.
This exposed the internal LogLevel enum in BCLDebug which causes an issue when consumed in XA:

```
Java.Lang/Object.cs(119,18): error CS0104: 'LogLevel' is an ambiguous reference between 'Android.Runtime.LogLevel' and 'System.LogLevel'
```

To fix this we rename the internal enum in corlib since it's not really used.
2019-12-11 11:34:23 +02:00
monojenkins b951ebb775 [debugger] skip suspend for unattached threads (#18110)
[2019-12] [debugger] skip suspend for unattached threads

When the debugger tries to suspend all the VM threads, it can happen with cooperative-suspend that it tries to suspend a thread that has previously been attached, but then did a "light" detach (that only unsets the domain). With the domain set to `NULL`, looking up a JitInfo for a given `ip` will result into a crash, but it isn't even necessarily needed for the purpose of suspending a thread.

More details: Consider the following:
```
(lldb) c
error: Process is running.  Use 'process interrupt' to pause execution.
Process 12832 stopped
* thread #9, name = 'tid_a31f', queue = 'NSOperationQueue 0x8069b670 (QOS: UTILITY)', stop reason = breakpoint 1.1
    frame #0: 0x00222870 WatchWCSessionAppWatchOSExtension`debugger_interrupt_critical(info=0x81365400, user_data=0xb04dc718) at debugger-agent.c:2716:6
   2713         MonoDomain *domain = (MonoDomain *) mono_thread_info_get_suspend_state (info)->unwind_data [MONO_UNWIND_DATA_DOMAIN];
   2714         if (!domain) {
   2715                 /* not attached */
-> 2716                 ji = NULL;
   2717         } else {
   2718                 ji = mono_jit_info_table_find_internal ( domain, MONO_CONTEXT_GET_IP (&mono_thread_info_get_suspend_state (info)->ctx), TRUE, TRUE);
   2719         }
Target 0: (WatchWCSessionAppWatchOSExtension) stopped.
(lldb) bt
* thread #9, name = 'tid_a31f', queue = 'NSOperationQueue 0x8069b670 (QOS: UTILITY)', stop reason = breakpoint 1.1
  * frame #0: 0x00222870 WatchWCSessionAppWatchOSExtension`debugger_interrupt_critical(info=0x81365400, user_data=0xb04dc718) at debugger-agent.c:2716:6
    frame #1: 0x004e177b WatchWCSessionAppWatchOSExtension`mono_thread_info_safe_suspend_and_run(id=0xb0767000, interrupt_kernel=0, callback=(WatchWCSessionAppWatchOSExtension`debugger_interrupt_critical at debugger-agent.c:2708), user_data=0xb04dc718) at mono-threads.c:1358:19
    frame #2: 0x00222799 WatchWCSessionAppWatchOSExtension`notify_thread(key=0x03994508, value=0x81378c00, user_data=0x00000000) at debugger-agent.c:2747:2
    frame #3: 0x00355bd8 WatchWCSessionAppWatchOSExtension`mono_g_hash_table_foreach(hash=0x8007b4e0, func=(WatchWCSessionAppWatchOSExtension`notify_thread at debugger-agent.c:2733), user_data=0x00000000) at mono-hash.c:310:4
    frame #4: 0x0021e955 WatchWCSessionAppWatchOSExtension`suspend_vm at debugger-agent.c:2844:3
    frame #5: 0x00225ff0 WatchWCSessionAppWatchOSExtension`process_event(event=EVENT_KIND_THREAD_START, arg=0x039945d0, il_offset=0, ctx=0x00000000, events=0x805b28e0, suspend_policy=2) at debugger-agent.c:4012:3
    frame #6: 0x00227c7c WatchWCSessionAppWatchOSExtension`process_profiler_event(event=EVENT_KIND_THREAD_START, arg=0x039945d0) at debugger-agent.c:4072:2
    frame #7: 0x0021b174 WatchWCSessionAppWatchOSExtension`thread_startup(prof=0x00000000, tid=2957889536) at debugger-agent.c:4149:2
    frame #8: 0x0037912d WatchWCSessionAppWatchOSExtension`mono_profiler_raise_thread_started(tid=2957889536) at profiler-events.h:103:1
    frame #9: 0x003d53da WatchWCSessionAppWatchOSExtension`fire_attach_profiler_events(tid=0xb04dd000) at threads.c:1120:2
    frame #10: 0x003d4d83 WatchWCSessionAppWatchOSExtension`mono_thread_attach(domain=0x801750a0) at threads.c:1547:2
    frame #11: 0x003df1a1 WatchWCSessionAppWatchOSExtension`mono_threads_attach_coop_internal(domain=0x801750a0, cookie=0xb04dcc0c, stackdata=0xb04dcba8) at threads.c:6008:3
    frame #12: 0x003df287 WatchWCSessionAppWatchOSExtension`mono_threads_attach_coop(domain=0x00000000, dummy=0xb04dcc0c) at threads.c:6045:9
    frame #13: 0x005034b8 WatchWCSessionAppWatchOSExtension`::xamarin_switch_gchandle(self=0x80762c20, to_weak=false) at runtime.m:1805:2
    frame #14: 0x005065c1 WatchWCSessionAppWatchOSExtension`::xamarin_retain_trampoline(self=0x80762c20, sel="retain") at trampolines.m:693:2
    frame #15: 0x657ea520 libobjc.A.dylib`objc_retain + 64
    frame #16: 0x4b4d9caa WatchConnectivity`__66-[WCSession onqueue_handleDictionaryMessageRequest:withPairingID:]_block_invoke + 279
    frame #17: 0x453c7df7 Foundation`__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    frame #18: 0x453c7cf4 Foundation`-[NSBlockOperation main] + 88
    frame #19: 0x453cacee Foundation`__NSOPERATION_IS_INVOKING_MAIN__ + 27
    frame #20: 0x453c6ebd Foundation`-[NSOperation start] + 835
    frame #21: 0x453cb606 Foundation`__NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 27
    frame #22: 0x453cb12e Foundation`__NSOQSchedule_f + 194
    frame #23: 0x453cb26e Foundation`____addOperations_block_invoke_4 + 20
    frame #24: 0x65de007b libdispatch.dylib`_dispatch_call_block_and_release + 15
    frame #25: 0x65de126f libdispatch.dylib`_dispatch_client_callout + 14
    frame #26: 0x65de3788 libdispatch.dylib`_dispatch_continuation_pop + 421
    frame #27: 0x65de2ee3 libdispatch.dylib`_dispatch_async_redirect_invoke + 818
    frame #28: 0x65df087d libdispatch.dylib`_dispatch_root_queue_drain + 354
    frame #29: 0x65df0ff3 libdispatch.dylib`_dispatch_worker_thread2 + 109
    frame #30: 0x66024fa0 libsystem_pthread.dylib`_pthread_wqthread + 208
    frame #31: 0x66024e44 libsystem_pthread.dylib`start_wqthread + 36
```

Going further, `info` is about this thread:
```
(lldb) p/x *(int *)(((char *) info->node.key) + 0xa0)
(int) $2 = 0x01243f93
(lldb) thread list
Process 12832 stopped
  thread #1: tid = 0x1243ee1, 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10, name = 'tid_303', queue = 'com.apple.main-thread'
  thread #2: tid = 0x1243ee6, 0x65f816e2 libsystem_kernel.dylib`__recvfrom + 10
  thread #3: tid = 0x1243ee7, 0x65f81aea libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #4: tid = 0x1243ee9, 0x65f7e3d2 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
  thread #5: tid = 0x1243eea, 0x65f816e2 libsystem_kernel.dylib`__recvfrom + 10, name = 'Debugger agent'
  thread #6: tid = 0x1243f1d, 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10, name = 'com.apple.uikit.eventfetch-thread'
  thread #8: tid = 0x1243f93, 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10, name = 'tid_6d0f', queue = 'NSOperationQueue 0x8069b300 (QOS: UTILITY)'
* thread #9: tid = 0x12443a9, 0x00222870 WatchWCSessionAppWatchOSExtension`debugger_interrupt_critical(info=0x81365400, user_data=0xb04dc718) at debugger-agent.c:2716:6, name = 'tid_a31f', queue = 'NSOperationQueue 0x8069b670 (QOS: UTILITY)', stop reason = breakpoint 1.1
  thread #10: tid = 0x1244581, 0x65f7fd32 libsystem_kernel.dylib`__workq_kernreturn + 10
(lldb) thread select 8
* thread #8, name = 'tid_6d0f', queue = 'NSOperationQueue 0x8069b300 (QOS: UTILITY)'
    frame #0: 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10
libsystem_kernel.dylib`mach_msg_trap:
->  0x65f7e396 <+10>: retl
    0x65f7e397 <+11>: nop

libsystem_kernel.dylib`mach_msg_overwrite_trap:
    0x65f7e398 <+0>:  movl   $0xffffffe0, %eax         ; imm = 0xFFFFFFE0
    0x65f7e39d <+5>:  calll  0x65f85f44                ; _sysenter_trap
(lldb) bt
* thread #8, name = 'tid_6d0f', queue = 'NSOperationQueue 0x8069b300 (QOS: UTILITY)'
  * frame #0: 0x65f7e396 libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x65f7e8ff libsystem_kernel.dylib`mach_msg + 47
    frame #2: 0x66079679 libxpc.dylib`_xpc_send_serializer + 104
    frame #3: 0x660794da libxpc.dylib`_xpc_pipe_simpleroutine + 80
    frame #4: 0x66079852 libxpc.dylib`xpc_pipe_simpleroutine + 43
    frame #5: 0x66043a8f libsystem_trace.dylib`___os_activity_stream_reflect_block_invoke_2 + 30
    frame #6: 0x65de126f libdispatch.dylib`_dispatch_client_callout + 14
    frame #7: 0x65de3d71 libdispatch.dylib`_dispatch_block_invoke_direct + 257
    frame #8: 0x65de3c62 libdispatch.dylib`dispatch_block_perform + 112
    frame #9: 0x6604349a libsystem_trace.dylib`_os_activity_stream_reflect + 725
    frame #10: 0x6604ef19 libsystem_trace.dylib`_os_log_impl_stream + 468
    frame #11: 0x6604e44d libsystem_trace.dylib`_os_log_impl_flatten_and_send + 6410
    frame #12: 0x6604cb3b libsystem_trace.dylib`_os_log + 137
    frame #13: 0x6604f4aa libsystem_trace.dylib`_os_log_impl + 31
    frame #14: 0x4b4eb4e9 WatchConnectivity`WCSerializePayloadDictionary + 393
    frame #15: 0x4b4d7c4d WatchConnectivity`-[WCSession onqueue_sendResponseDictionary:identifier:] + 195
    frame #16: 0x4b4da435 WatchConnectivity`__66-[WCSession onqueue_handleDictionaryMessageRequest:withPairingID:]_block_invoke.411 + 35
    frame #17: 0x453c7df7 Foundation`__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    frame #18: 0x453c7cf4 Foundation`-[NSBlockOperation main] + 88
    frame #19: 0x453cacee Foundation`__NSOPERATION_IS_INVOKING_MAIN__ + 27
    frame #20: 0x453c6ebd Foundation`-[NSOperation start] + 835
    frame #21: 0x453cb606 Foundation`__NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 27
    frame #22: 0x453cb12e Foundation`__NSOQSchedule_f + 194
    frame #23: 0x453cb067 Foundation`____addOperations_block_invoke_2 + 20
    frame #24: 0x65dedf49 libdispatch.dylib`_dispatch_block_async_invoke2 + 77
    frame #25: 0x65de4461 libdispatch.dylib`_dispatch_block_async_invoke_and_release + 17
    frame #26: 0x65de126f libdispatch.dylib`_dispatch_client_callout + 14
    frame #27: 0x65de3788 libdispatch.dylib`_dispatch_continuation_pop + 421
    frame #28: 0x65de2ee3 libdispatch.dylib`_dispatch_async_redirect_invoke + 818
    frame #29: 0x65df087d libdispatch.dylib`_dispatch_root_queue_drain + 354
    frame #30: 0x65df0ff3 libdispatch.dylib`_dispatch_worker_thread2 + 109
    frame #31: 0x66024fa0 libsystem_pthread.dylib`_pthread_wqthread + 208
    frame #32: 0x66024e44 libsystem_pthread.dylib`start_wqthread + 36
```
which is a thread in a "light" detach state (aka. coop detach), where we only unset the domain:
https://github.com/mono/mono/blob/4cefdcb7ce2d939ee78fb45d1b4913eb3bc064fd/mono/metadata/threads.c#L6084-L6111

Fixes https://github.com/mono/mono/issues/17926



<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->


Backport of #18105.

/cc @lewurm
2019-12-10 18:15:09 +01:00
monojenkins 47262ff08a [2019-12] [mini] Fix delegate trampoline virtual call via delgate Invoke (#18109)
* [mini] Fix delegate trampoline virtual call via delgate Invoke

If we need to jit the Invoke method of a delegate, we get tramp_info with a
NULL method.

Background: normally when we create a delegate around a virtual method,
handle_delegate_ctor will just create a virtual invoke trampoline with
mono_arch_get_delegate_virtual_invoke_impl which doesn't get here.  But if
we're asked to compile the delegate's Invoke method, then compile_special ()
will create a tramp_info with a null method, and return a delegate trampoline.

That's the case here - we had
  var del = SomeDelegate(obj.VirtualMethod);
  var invoke_method = del.GetType().GetMethod ("Invoke");
  invoke_method.Invoke (del, args);
or
  var del = SomeDelegate(obj.VirtualMethod);
  var another_del = OtherDelegate (del.Invoke);
  another_del (args);

in both cases, we end up in mono_delegate_trampoline with tramp_info->method ==
NULL.

in the second case the IL is like this:
   newobj instance void Derived::'.ctor'
   ldvirtftn instance void class Base::VirtualMethod()
   newobj instance void class SomeDelegate::'.ctor'(object, native int)

So delegate->target is a derived instance but delegate->method is some base
class method.

Addresses https://github.com/mono/mono/issues/17718

* [tests] Add tests for compiling delegate's Invoke method

Where the delegate calls a virtual method
2019-12-10 17:43:04 +01:00
Ankit Jain 17a925ca25 Bump msbuild+roslyn to track mono-2019-10 (#18092)
* Bump msbuild+roslyn to track mono-2019-10

- bumps roslyn to 3.5.0-beta1-19606-04

* roslyn: Delete reference to the now removed Microsoft.Managed.EditorConfig.targets
2019-12-10 12:39:51 +01:00
monojenkins a2bb316900 Bump to mono/corefx@f3815a9 (#18099)
Picks up https://github.com/mono/corefx/pull/376
2019-12-10 12:35:56 +01:00
monojenkins cbc3a80a27 [2019-12] [threads] Add back mono_threads_attach_tools_thread as a public API (#18074)
* [utils] Add back mono_threads_attach_tools_thread

In https://github.com/mono/mono/commit/a5da7b21f4b6dbc5eaa09c2addee91b84dc1dbd5
we got rid of "tools" threads internally to the runtime.

However since the API was previously marked with MONO_API it was an internal
API that some embedders depended on.

This PR adds back an (external-only) limited form of tools thread.

The runtime is aware of the Tools thread in that FOREACH_THREAD_* macros will
iterate over them, and the thread has a coop thread state machine. (That is,
mono_thread_info_current() and GC Safe and GC Unsafe transitions all work.)

However the thread is:
1. Not stopped by the GC
2. Is not interrupted by profiler sampling.
3. Does not have a "current domain"
4. (As a consequence of the above) cannot call managed methods or touch managed
objects.

Such threads are useful for low-level interaction with the runtime such as
querying metadata, the JIT state and other coordination.

mono_threads_attach_tools_thread should be called no more than once.  It should
not be called on a thread that is already attached with mono_thread_atach, and
vice versa.

Addresses https://github.com/mono/mono/issues/18011

* [threads] Make mono_threads_attach_tools_thread into a public API
2019-12-09 10:06:43 +01:00
monojenkins 2538b65b30 Update glib-remap.h to include g_module_address (#18077) 2019-12-09 10:06:17 +01:00
monojenkins 5d83bf4c65 [2019-12] Added Obsolete to AppDomain.CreateDomain for monodroid. (#18026)
* Added Obsolete to AppDomain.CreateDomain for monodroid. The intent is to be helpful for when .NET 5 comes along

* Changed AssemblyLoadContext link to a better doc

* Bump API snapshot submodule
2019-12-06 18:45:36 +01:00
monojenkins 37c475126d [llvm] Avoid decomposing OP_STOREV_MEMBASE early for types which contains no references. (#18065) 2019-12-06 12:24:16 +01:00
Alexander Köplinger 50d4fc360c Remove DNS lookups of the local hostname in tests (#18059)
This allows us to workaround issues we currently have in the macOS bot network where DNS lookup of the hostname fails.

(cherry picked from commit 269d509e42)
2019-12-05 23:21:13 +01:00
monojenkins 159160da7b [System.Net.Http]Add workaround for mono/mono#17897. (#18010)
Use `(UriKind)300` (which is the same as setting `MONO_URI_DOTNETRELATIVEORABSOLUTE=true`)
when parsing Uri headers.
2019-12-05 14:40:49 +01:00
monojenkins 25b7c45431 [2019-12] [corlib] add InternalsVisibleTo for Mono.Android (#18047)
* [corlib] add InternalsVisibleTo for Mono.Android

Context: https://github.com/xamarin/xamarin-android/pull/3991

In Xamarin.Android, we have a bit of System.Reflection usage on
startup:

https://github.com/xamarin/xamarin-android/blob/bbbe2ed36e6eeb7cce0905dcbfdaeaa30754070f/src/Mono.Android/Android.Runtime/UncaughtExceptionHandler.cs#L47-L67

These methods are in `mscorlib.dll` and `internal`. If we had
`[assembly: InternalsVisibleTo ("Mono.Android")]` we could avoid the
System.Reflection.

This is already done for `Xamarin.iOS`, `Xamarin.Mac`, etc. so
hopefully it's OK to add one more?

We could then, just call these methods directly:

* `System.Diagnostics.Debugger.Mono_UnhandledException`
* `AppDomain.CurrentDomain.DoUnhandledException`

The results are possibly a 100-250ms improvement to startup:

    Before:
    12-03 14:27:51.450  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s727ms
    12-03 14:27:57.310  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s723ms
    12-03 14:28:03.216  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s703ms
    12-03 14:28:09.054  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s679ms
    12-03 14:28:14.953  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s711ms
    After:
    12-04 09:13:18.248  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s608ms
    12-04 09:13:24.087  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s570ms
    12-04 09:13:29.997  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s566ms
    12-04 09:13:35.805  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s498ms
    12-04 09:13:41.670  1876  1898 I ActivityManager: Displayed Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity: +3s475ms

This was the Xamarin.Forms integration project in xamarin-android.
Running a `Debug` build on a HAXM x86 emulator on Windows.

https://github.com/xamarin/xamarin-android/tree/master/tests/Xamarin.Forms-Performance-Integration

* Bump API snapshot submodule
2019-12-05 00:44:10 +01:00
Alexander Köplinger 3e0d18cb7b Bump bockbuild to get https://github.com/mono/bockbuild/pull/136 2019-12-05 00:35:14 +01:00
Ankit Jain 8228edb9a2 [2019-12] Bump msbuild to track mono-2019-10 (#18046)
.. to get changes from https://github.com/mono/msbuild/pull/163 .

And bump roslyn to 3.4.0-beta4-19569-03 to match msbuild.
2019-12-04 18:10:51 -05:00
Thays Grazia c823f329f1 Fix side effect. 2019-12-04 14:57:40 -06:00
Thays Grazia bb4cd21233 Fix DIM in a generic interface. Fixes #17869 2019-12-04 14:57:40 -06:00
monojenkins 7327c13535 [2019-12] [profiler] disable inlining when coverage profiler is used and fix allocation sizes (#17999)
* [profiler] let compiler decide about the size of an entry

* [profiler] disable inlining when coverage profiler is used
2019-12-03 16:47:09 +01:00
monojenkins 7eb7a82f09 [sgen] Don't trigger collections during allocation of thread objects (#17996)
Allocation of thread objects usese the mono_object_new_mature API. These objects are allocated before the thread is finished attaching to the runtime. This means that a collection can happen on an unattached thread as well as all its callbacks, which is a counter-intuitive behavior.

On android this is problematic because at the end of the SGen collection we need to call the java collection, which needs to have the thread attached. This could probably be fixed instead from the Xamarin.Android side, but this approach seems simpler and saner.

Fixes https://github.com/mono/mono/issues/17878
2019-12-03 10:10:25 +02:00
Jo Shields 94ad23218f Bump version to 6.10 (#17989) 2019-12-02 15:58:36 -05:00
524 changed files with 10629 additions and 18075 deletions

No files matched your search

+1 -3
View File
@@ -20,10 +20,8 @@ m4/mono-output.m4 crlf=input
*.sln crlf
*.*proj* crlf
*.bat text eol=crlf
*.cmd text eol=crlf
# don't do anything to line-endings. Let CRLFs/LFs go into the repo, and CRLF/LFs on checkout
*.bat -crlf
*.xml -crlf
# CRLF Handling
+1 -1
View File
@@ -4,7 +4,7 @@ AM_CFLAGS = $(WERROR_CFLAGS)
SUBDIRS = @MONO_SUBDIRS@
noinst_SUBDIRS = @MONO_NOINST_SUBDIRS@
DIST_SUBDIRS = $(SUBDIRS) m4 netcore
DIST_SUBDIRS = $(SUBDIRS) m4 netcore netcore/corerun
if !ENABLE_NETCORE
+5 -14
View File
@@ -104,10 +104,12 @@ if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
fi
fi
# Parse parameters
#
# Plug in the extension module
#
has_ext_mod=false
ext_mod_args=''
has_disable_boehm=false
for PARAM; do
if [[ $PARAM =~ "--enable-extension-module" ]] ; then
has_ext_mod=true
@@ -115,14 +117,8 @@ for PARAM; do
ext_mod_args=`echo $PARAM | cut -d= -f2`
fi
fi
if [[ $PARAM =~ "--disable-boehm" ]] ; then
has_disable_boehm=true
fi
done
#
# Plug in the extension module
#
if test x$has_ext_mod = xtrue; then
pushd $top_srcdir../mono-extensions/scripts
sh ./prepare-repo.sh $ext_mod_args || exit 1
@@ -154,12 +150,7 @@ automake $am_opt ||
echo "Running autoconf ..."
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
# Update all submodules recursively to ensure everything is checked out
if test -e $srcdir/scripts/update_submodules.sh; then
(cd $srcdir && scripts/update_submodules.sh)
fi
if test x$has_disable_boehm = xfalse -a -d $srcdir/external/bdwgc; then
if test -d $srcdir/external/bdwgc; then
echo Running external/bdwgc/autogen.sh ...
(cd $srcdir/external/bdwgc ; NOCONFIGURE=1 ./autogen.sh "$@")
echo Done running external/bdwgc/autogen.sh ...
+28 -64
View File
@@ -4,7 +4,7 @@
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
# It should remain in the format they expect.
#
AC_INIT(mono, [6.13.0],
AC_INIT(mono, [6.10.0],
[https://github.com/mono/mono/issues/new])
AC_CONFIG_SRCDIR([Makefile.am])
@@ -63,7 +63,7 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
# It should remain in the format they expect.
#
MONO_CORLIB_VERSION=1A5E0066-58DC-428A-B21C-0AD6CDAE2789
MONO_CORLIB_VERSION=97b07b51-46d8-4084-b48e-77aa5c192654
#
# Put a quoted #define in config.h.
@@ -358,10 +358,6 @@ case "$host" in
# https://bugzilla.novell.com/show_bug.cgi?id=504411
disable_munmap=yes
;;
powerpc*-*-freebsd*)
# https://bugzilla.novell.com/show_bug.cgi?id=504411
disable_munmap=yes
;;
riscv*)
support_boehm=no
with_gc=sgen
@@ -677,7 +673,7 @@ AC_PROG_LD_GNU
AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h sys/prctl.h copyfile.h gnu/lib-names.h)
AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h complex.h unwind.h)
# zlib/configure checks for unistd.h existence and defines HAVE_UNISTD_H on the compiler
# zlib/configure checks for unistd.h existance and defines HAVE_UNISTD_H on the compiler
# command line (not config.h) if it is present.
AC_CHECK_HEADER(unistd.h,
[HAVE_UNISTD_H=1
@@ -1362,9 +1358,7 @@ MONO_LLVM_PATH_OPTION=llvm-path="`pwd`/llvm/usr/bin"
if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
DISABLE_MCS_DOCS_default=yes
fi
if test x$with_runtime_preset = xnetcore; then
elif test x$with_runtime_preset = xnetcore; then
# Keep in sync with winconfig.h netcore configuration.
DISABLE_MCS_DOCS_default=yes
BTLS_SUPPORTED=no
@@ -1758,7 +1752,7 @@ AM_CONDITIONAL(ENABLE_STATIC_GCC_LIBS, test "x$enable_static_gcc_libs" = "xyes")
AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, appdomains, verifier, dllmap,
reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, interpreter, simd, soft_debug, perfcounters, normalization, desktop_loader, shared_perfcounters, remoting,
security, lldb, mdb, assert_messages, cfgdir_config, cleanup, sgen_marksweep_conc, sgen_split_nursery, sgen_gc_bridge, sgen_debug_helpers, sockets, gac, threads.],
security, lldb, mdb, assert_messages, cleanup, sgen_marksweep_conc, sgen_split_nursery, sgen_gc_bridge, sgen_debug_helpers, sockets, gac, threads.],
[
for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
eval "mono_feature_disable_$feature='yes'"
@@ -1934,11 +1928,6 @@ if test "x$mono_feature_disable_assert_messages" = "xyes"; then
AC_MSG_NOTICE([Disabled assertion messages.])
fi
if test "x$mono_feature_disable_cfgdir_config" = "xyes"; then
AC_DEFINE(DISABLE_CFGDIR_CONFIG, 1, [Disable config directories.])
AC_MSG_NOTICE([Disabled config directories.])
fi
if test "x$mono_feature_disable_cleanup" = "xyes"; then
AC_DEFINE(DISABLE_CLEANUP, 1, [Disable runtime cleanup.])
AC_MSG_NOTICE([Disabled runtime cleanup.])
@@ -4480,28 +4469,13 @@ case "$host" in
;;
macppc-*-openbsd* | powerpc*-*-linux* | powerpc-*-openbsd* | \
powerpc-*-sysv* | powerpc-*-darwin* | powerpc-*-netbsd* | \
powerpc*-*-freebsd* | powerpc*-*-aix* | powerpc*-*-os400* )
powerpc-*-freebsd* | powerpc*-*-aix* | powerpc*-*-os400* )
if test "x$ac_cv_sizeof_void_p" = "x8"; then
TARGET=POWERPC64;
CPPFLAGS="$CPPFLAGS -D__mono_ppc__ -D__mono_ppc64__"
# mono#18554 - be more robust in testing for -mminimal-toc
AC_MSG_NOTICE([Checking for PowerPC ISA -mminimal-toc support])
AX_CHECK_COMPILE_FLAG(
[-mminimal-toc],
[CFLAGS="$CFLAGS -mminimal-toc"],
[CFLAGS="$CFLAGS"]
)
case "$host" in
powerpc*-*-freebsd*)
# We need to be aware if we are ELFv1 or v2 here
AC_MSG_NOTICE([Checking FreeBSD ELF version])
if ! ( echo | cc -dM -E - | awk '/_CALL_ELF/ {print $NF}'); then
AC_DEFINE([POWERPC_ELF], 1, [PowerPC ELFv1])
else
AC_DEFINE([POWERPC_ELFV2], 1, [PowerPC ELFv2])
fi
;;
esac
if ! (echo $CC | grep -q -- 'clang'); then
CFLAGS="$CFLAGS -mminimal-toc"
fi
else
TARGET=POWERPC;
CPPFLAGS="$CPPFLAGS -D__mono_ppc__"
@@ -4516,10 +4490,6 @@ case "$host" in
BTLS_SUPPORTED=yes
BTLS_PLATFORM=powerpc
;;
freebsd*)
BTLS_SUPPORTED=yes
BTLS_PLATFORM=powerpc
;;
esac
;;
armv7k-*-darwin*)
@@ -5055,23 +5025,21 @@ case "$host" in
SQLITE3="libsqlite3.so"
;;
*-*-*linux*)
if test "x$with_core" != "xonly"; then
AC_PATH_X
dlsearch_path=`(libtool --config ; echo eval echo \\$sys_lib_dlsearch_path_spec) | sh`
AC_MSG_CHECKING(for the soname of libX11.so)
for i in $x_libraries $dlsearch_path; do
for r in 4 5 6; do
if test -f $i/libX11.so.$r; then
X11=libX11.so.$r
AC_MSG_RESULT($X11)
fi
done
AC_PATH_X
dlsearch_path=`(libtool --config ; echo eval echo \\$sys_lib_dlsearch_path_spec) | sh`
AC_MSG_CHECKING(for the soname of libX11.so)
for i in $x_libraries $dlsearch_path; do
for r in 4 5 6; do
if test -f $i/libX11.so.$r; then
X11=libX11.so.$r
AC_MSG_RESULT($X11)
fi
done
if test "x$X11" = "xlibX11.so"; then
AC_MSG_WARN([Could not find libX11.so. Do you have X.org or XFree86 installed? Assuming libX11.so.6...]);
X11=libX11.so.6
fi
done
if test "x$X11" = "xlibX11.so"; then
AC_MSG_WARN([Could not find libX11.so. Do you have X.org or XFree86 installed? Assuming libX11.so.6...]);
X11=libX11.so.6
fi
;;
esac
@@ -5186,12 +5154,8 @@ AC_SEARCH_LIBS(dlopen, dl)
#
export_link_flags=--export-dynamic
case $host_os in
mingw*|cygwin*)
mingw*|cygwin*)
export_link_flags=--export-all-symbols
;;
*-*-darwin*)
export_link_flags=--export_dynamic
;;
esac
AX_APPEND_LINK_FLAGS([-Wl,$export_link_flags -Wl,-Bsymbolic -bsymbolic -Wl,-z,now -Wl,-bind_at_load])
@@ -6099,8 +6063,8 @@ fi
AC_SUBST(mono_runtime)
AC_SUBST(mono_runtime_wrapper)
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.5.0/csc.exe
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.5.0/VBCSCompiler.exe
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.6.0/csc.exe
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.6.0/VBCSCompiler.exe
if test $csc_compiler = mcs; then
CSC=$mcs_topdir/class/lib/build/mcs.exe
@@ -6291,7 +6255,7 @@ fi
# Top level Makefile.am subdirs
if test "x$with_core" = "xonly"; then
MONO_SUBDIRS="llvm mono"
MONO_SUBDIRS="mk llvm mono"
else
if test "x$support_boehm" = "xyes" -a "x$libgc" = "xincluded"; then
mono_subdirs_libgc=external/bdwgc
@@ -6314,7 +6278,7 @@ else
mono_subdirs_ikvm_native=ikvm-native
fi
MONO_SUBDIRS="po $mono_subdirs_libgc llvm mono $mono_subdirs_ikvm_native $mono_subdirs_support data runtime scripts man samples $mono_subdirs_tools $mono_subdirs_docs msvc acceptance-tests"
MONO_SUBDIRS="mk po $mono_subdirs_libgc llvm mono $mono_subdirs_ikvm_native $mono_subdirs_support data runtime scripts man samples $mono_subdirs_tools $mono_subdirs_docs msvc acceptance-tests"
MONO_NOINST_SUBDIRS="$mono_subdirs_libgc"
fi
@@ -242,7 +242,7 @@ namespace HtmlAgilityPack
}
/// <summary>
/// Checks for existence of attribute with given name
/// Checks for existance of attribute with given name
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
+4 -4
View File
@@ -15,13 +15,13 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20109.1">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.19574.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>b0e8d3944155f94f83deea8afe025debe369e69f</Sha>
<Sha>87b59e17420bf0c3341edacbd8a6721e619afbac</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="5.0.0-beta.20109.1">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="5.0.0-beta.19574.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>b0e8d3944155f94f83deea8afe025debe369e69f</Sha>
<Sha>87b59e17420bf0c3341edacbd8a6721e619afbac</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
+29 -36
View File
@@ -16,7 +16,7 @@
# condition: eq(variables['Agent.OS'], 'Windows_NT')
# inputs:
# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
# arguments: -ConfigFile ${Env:BUILD_SOURCESDIRECTORY}/NuGet.config -Password $Env:Token
# env:
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
@@ -94,48 +94,41 @@ function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Password) {
}
}
if (!(Test-Path $ConfigFile -PathType Leaf)) {
Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile"
ExitWithExitCode 1
}
if (!$Password) {
Write-PipelineTelemetryError -Category 'Build' -Message 'Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Please supply a valid PAT'
try {
if (!(Test-Path $ConfigFile -PathType Leaf)) {
Write-PipelineTelemetryError -Category 'Build' -Message "Couldn't find the file NuGet config file: $ConfigFile"
ExitWithExitCode 1
}
}
# Load NuGet.config
$doc = New-Object System.Xml.XmlDocument
$filename = (Get-Item $ConfigFile).FullName
$doc.Load($filename)
# Load NuGet.config
$doc = New-Object System.Xml.XmlDocument
$filename = (Get-Item $ConfigFile).FullName
$doc.Load($filename)
# Get reference to <PackageSources> or create one if none exist already
$sources = $doc.DocumentElement.SelectSingleNode("packageSources")
if ($sources -eq $null) {
$sources = $doc.CreateElement("packageSources")
$doc.DocumentElement.AppendChild($sources) | Out-Null
}
# Get reference to <PackageSources> or create one if none exist already
$sources = $doc.DocumentElement.SelectSingleNode("packageSources")
if ($sources -eq $null) {
$sources = $doc.CreateElement("packageSources")
$doc.DocumentElement.AppendChild($sources) | Out-Null
}
# Looks for a <PackageSourceCredentials> node. Create it if none is found.
$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials")
if ($creds -eq $null) {
$creds = $doc.CreateElement("packageSourceCredentials")
$doc.DocumentElement.AppendChild($creds) | Out-Null
}
# Looks for a <PackageSourceCredentials> node. Create it if none is found.
$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials")
if ($creds -eq $null) {
$creds = $doc.CreateElement("packageSourceCredentials")
$doc.DocumentElement.AppendChild($creds) | Out-Null
}
# Insert credential nodes for Maestro's private feeds
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password
# Insert credential nodes for Maestro's private feeds
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password
$dotnet3Source = $sources.SelectSingleNode("add[@key='dotnet3']")
if ($dotnet3Source -ne $null) {
AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
}
$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']")
if ($dotnet31Source -ne $null) {
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
$doc.Save($filename)
}
catch {
Write-Host $_.ScriptStackTrace
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_
ExitWithExitCode 1
}
$doc.Save($filename)
+23 -55
View File
@@ -17,7 +17,7 @@
# displayName: Setup Private Feeds Credentials
# inputs:
# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
# arguments: $(Build.SourcesDirectory)/NuGet.config $Token
# arguments: $BUILD_SOURCESDIRECTORY/NuGet.config $Token
# condition: ne(variables['Agent.OS'], 'Windows_NT')
# env:
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
@@ -42,12 +42,7 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
. "$scriptroot/tools.sh"
if [ ! -f "$ConfigFile" ]; then
Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile"
ExitWithExitCode 1
fi
if [ -z "$CredToken" ]; then
Write-PipelineTelemetryError -category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Please supply a valid PAT"
Write-PipelineTelemetryError -Category 'Build' -Message "Couldn't find the file NuGet config file: $ConfigFile"
ExitWithExitCode 1
fi
@@ -57,7 +52,7 @@ if [[ `uname -s` == "Darwin" ]]; then
fi
# Ensure there is a <packageSources>...</packageSources> section.
grep -i "<packageSources>" $ConfigFile
grep -i "<packageSources>" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding <packageSources>...</packageSources> section."
ConfigNodeHeader="<configuration>"
@@ -67,7 +62,7 @@ if [ "$?" != "0" ]; then
fi
# Ensure there is a <packageSourceCredentials>...</packageSourceCredentials> section.
grep -i "<packageSourceCredentials>" $ConfigFile
grep -i "<packageSourceCredentials>" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding <packageSourceCredentials>...</packageSourceCredentials> section."
@@ -77,64 +72,37 @@ if [ "$?" != "0" ]; then
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" NuGet.config
fi
PackageSources=()
# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources
grep -i "<add key=\"dotnet3-internal\">" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding dotnet3-internal to the packageSources."
# Ensure dotnet3-internal and dotnet3-internal-transport are in the packageSources if the public dotnet3 feeds are present
grep -i "<add key=\"dotnet3\"" $ConfigFile
PackageSourcesNodeFooter="</packageSources>"
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2\" />"
if [ "$?" == "0" ]; then
grep -i "<add key=\"dotnet3-internal\">" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding dotnet3-internal to the packageSources."
PackageSourcesNodeFooter="</packageSources>"
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2\" />"
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
fi
PackageSources+=('dotnet3-internal')
grep -i "<add key=\"dotnet3-internal-transport\"" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding dotnet3-internal-transport to the packageSources."
PackageSourcesNodeFooter="</packageSources>"
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2\" />"
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
fi
PackageSources+=('dotnet3-internal-transport')
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" NuGet.config
fi
# Ensure dotnet3.1-internal and dotnet3.1-internal-transport are in the packageSources if the public dotnet3.1 feeds are present
grep -i "<add key=\"dotnet3.1\"" $ConfigFile
if [ "$?" == "0" ]; then
grep -i "<add key=\"dotnet3.1-internal\"" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding dotnet3.1-internal to the packageSources."
PackageSourcesNodeFooter="</packageSources>"
PackageSourceTemplate="${TB}<add key=\"dotnet3.1-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2\" />"
# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources
grep -i "<add key=\"dotnet3-internal-transport\">" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding dotnet3-internal-transport to the packageSources."
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
fi
PackageSources+=('dotnet3.1-internal')
PackageSourcesNodeFooter="</packageSources>"
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2\" />"
grep -i "<add key=\"dotnet3.1-internal-transport\">" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding dotnet3.1-internal-transport to the packageSources."
PackageSourcesNodeFooter="</packageSources>"
PackageSourceTemplate="${TB}<add key=\"dotnet3.1-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2\" />"
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
fi
PackageSources+=('dotnet3.1-internal-transport')
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" NuGet.config
fi
# I want things split line by line
PrevIFS=$IFS
IFS=$'\n'
PackageSources+="$IFS"
PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"')
PackageSources=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"')
IFS=$PrevIFS
PackageSources+=('dotnet3-internal')
PackageSources+=('dotnet3-internal-transport')
for FeedName in ${PackageSources[@]} ; do
# Check if there is no existing credential for this FeedName
grep -i "<$FeedName>" $ConfigFile
@@ -144,6 +112,6 @@ for FeedName in ${PackageSources[@]} ; do
PackageSourceCredentialsNodeFooter="</packageSourceCredentials>"
NewCredential="${TB}${TB}<$FeedName>${NL}<add key=\"Username\" value=\"dn-bot\" />${NL}<add key=\"ClearTextPassword\" value=\"$CredToken\" />${NL}</$FeedName>"
sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile
sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" NuGet.config
fi
done
+13 -9
View File
@@ -62,8 +62,6 @@ function Print-Usage() {
Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)."
}
. $PSScriptRoot\tools.ps1
function InitializeCustomToolset {
if (-not $restore) {
return
@@ -114,15 +112,21 @@ function Build {
@properties
}
try {
if ($clean) {
if (Test-Path $ArtifactsDir) {
Remove-Item -Recurse -Force $ArtifactsDir
Write-Host 'Artifacts directory deleted.'
}
exit 0
if ($clean) {
if(Test-Path $ArtifactsDir) {
Remove-Item -Recurse -Force $ArtifactsDir
Write-Host 'Artifacts directory deleted.'
}
exit 0
}
try {
. $PSScriptRoot\tools.ps1
If ((Test-Path variable:LastExitCode) -And ($LastExitCode -ne 0)) {
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message 'Eng/common/tools.ps1 returned a non-zero exit code.'
ExitWithExitCode $LastExitCode
}
if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) {
Print-Usage
exit 0
+4 -15
View File
@@ -25,9 +25,8 @@ __UbuntuPackages="build-essential"
__AlpinePackages="alpine-base"
__AlpinePackages+=" build-base"
__AlpinePackages+=" linux-headers"
__AlpinePackagesEdgeTesting=" lldb-dev"
__AlpinePackagesEdgeMain=" llvm9-libs"
__AlpinePackagesEdgeMain+=" python3"
__AlpinePackages+=" lldb-dev"
__AlpinePackages+=" llvm-dev"
# symlinks fixer
__UbuntuPackages+=" symlinks"
@@ -200,23 +199,13 @@ if [[ "$__LinuxCodeName" == "alpine" ]]; then
tar -xf $__ApkToolsDir/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -C $__ApkToolsDir
mkdir -p $__RootfsDir/usr/bin
cp -v /usr/bin/qemu-$__QEMUArch-static $__RootfsDir/usr/bin
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
-X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/main \
-X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/community \
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
add $__AlpinePackages
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
-X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
-X http://dl-cdn.alpinelinux.org/alpine/edge/main \
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
add $__AlpinePackagesEdgeMain
$__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \
-X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
-U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \
add $__AlpinePackagesEdgeTesting
add $__AlpinePackages
rm -r $__ApkToolsDir
elif [[ -n $__LinuxCodeName ]]; then
qemu-debootstrap --arch $__UbuntuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo
+1 -3
View File
@@ -24,15 +24,13 @@ function InstallDarcCli ($darcVersion) {
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
}
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
Write-Host "Installing Darc CLI version $darcVersion..."
Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.'
if (-not $toolpath) {
Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g"
& "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g
}else {
Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g --tool-path '$toolpath'"
& "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath"
}
}
+2 -7
View File
@@ -2,12 +2,7 @@ param(
[string] $token
)
. $PSScriptRoot\pipeline-logging-functions.ps1
# Write-PipelineSetVariable will no-op if a variable named $ci is not defined
# Since this script is only ever called in AzDO builds, just universally set it
$ci = $true
Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token -IsMultiJobVariable $false
Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/' -IsMultiJobVariable $false
Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token
Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/'
+1 -1
View File
@@ -3,7 +3,7 @@ Param(
[Parameter(Mandatory=$true)][string] $gitHubPat, # GitHub personal access token from https://github.com/settings/tokens (no auth scopes needed)
[Parameter(Mandatory=$true)][string] $azdoPat, # Azure Dev Ops tokens from https://dev.azure.com/dnceng/_details/security/tokens (code read scope needed)
[Parameter(Mandatory=$true)][string] $outputFolder, # Where the graphviz.txt file will be created
[string] $darcVersion, # darc's version
[string] $darcVersion = '1.1.0-beta.19175.6', # darc's version
[string] $graphvizVersion = '2.38', # GraphViz version
[switch] $includeToolset # Whether the graph should include toolset dependencies or not. i.e. arcade, optimization. For more about
# toolset dependencies see https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#toolset-vs-product-dependencies
+2 -4
View File
@@ -113,16 +113,14 @@ try {
}
$toolInstallationFailure = $true
} else {
# We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482
Write-Host $errMsg
Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message $errMsg
exit 1
}
}
}
if ((Get-Variable 'toolInstallationFailure' -ErrorAction 'SilentlyContinue') -and $toolInstallationFailure) {
# We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482
Write-Host 'Native tools bootstrap failed'
Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message 'Native tools bootstrap failed'
exit 1
}
}
+1 -1
View File
@@ -105,7 +105,7 @@ try {
Write-Error "There are multiple copies of $ToolName in $($ToolInstallDirectory): `n$(@($ToolFilePath | out-string))"
exit 1
} elseif (@($ToolFilePath).Length -Lt 1) {
Write-Host "$ToolName was not found in $ToolFilePath."
Write-Error "$ToolName was not found in $ToolFilePath."
exit 1
}
+3 -4
View File
@@ -9,12 +9,12 @@ Param(
[string] $Branch=$env:BUILD_SOURCEBRANCH,
[string] $CommitSha=$env:BUILD_SOURCEVERSION,
[string] $BuildNumber=$env:BUILD_BUILDNUMBER,
[string] $RunCategories="Libraries Runtime",
[string] $RunCategories="coreclr corefx",
[string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj",
[string] $Kind="micro",
[switch] $Internal,
[switch] $Compare,
[string] $Configurations="CompilationMode=$CompilationMode RunKind=$Kind"
[string] $Configurations="CompilationMode=$CompilationMode"
)
$RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") -or ($Repository -eq "dotnet-performance")
@@ -49,8 +49,7 @@ if ($Internal) {
$HelixSourcePrefix = "official"
}
# FIX ME: This is a workaround until we get this from the actual pipeline
$CommonSetupArguments="--channel master --queue $Queue --build-number $BuildNumber --build-configs $Configurations --architecture $Architecture"
$CommonSetupArguments="--frameworks $Framework --queue $Queue --build-number $BuildNumber --build-configs $Configurations"
$SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments"
if ($RunFromPerformanceRepo) {
+3 -3
View File
@@ -13,9 +13,9 @@ build_number=$BUILD_BUILDNUMBER
internal=false
compare=false
kind="micro"
run_categories="Libraries Runtime"
run_categories="coreclr corefx"
csproj="src\benchmarks\micro\MicroBenchmarks.csproj"
configurations="CompliationMode=$compilation_mode RunKind=$kind"
configurations=
run_from_perf_repo=false
use_core_run=true
use_baseline_core_run=true
@@ -164,7 +164,7 @@ if [[ "$internal" == true ]]; then
fi
fi
common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture"
common_setup_arguments="--frameworks $framework --queue $queue --build-number $build_number --build-configs $configurations"
setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments"
if [[ "$run_from_perf_repo" = true ]]; then
+3 -3
View File
@@ -85,7 +85,7 @@ function Write-PipelineTaskError {
[switch]$AsOutput,
[bool]$IsMultiJobVariable=$true)
if((Test-Path variable:ci) -And $ci) {
if(-Not (Test-Path variable:ci) -Or !$ci) {
Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{
'variable' = $Name
'isSecret' = $Secret
@@ -101,7 +101,7 @@ function Write-PipelineTaskError {
[string]$Path,
[switch]$AsOutput)
if((Test-Path variable:ci) -And $ci) {
if(-Not (Test-Path variable:ci) -Or !$ci) {
Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput
}
}
@@ -237,4 +237,4 @@ function Write-LogIssue {
}
Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor
}
}
@@ -17,7 +17,7 @@ try {
ExitWithExitCode 1
}
# Get info about which channel(s) the build has already been promoted to
# Get info about which channels the build has already been promoted to
$buildInfo = Get-MaestroBuild -BuildId $BuildId
if (!$buildInfo) {
+2 -18
View File
@@ -1,5 +1,4 @@
parameters:
enable: 'false' # Whether the SDL validation job should execute or not
overrideParameters: '' # Optional: to override values for parameters.
additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")'
# There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named
@@ -17,15 +16,8 @@ jobs:
- job: Run_SDL
dependsOn: ${{ parameters.dependsOn }}
displayName: Run SDL tool
condition: eq( ${{ parameters.enable }}, 'true')
variables:
- group: DotNet-VSTS-Bot
- name: AzDOProjectName
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- name: AzDOPipelineId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- name: AzDOBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
pool:
name: Hosted VS2017
steps:
@@ -36,22 +28,14 @@ jobs:
- task: DownloadBuildArtifacts@0
displayName: Download Build Artifacts
inputs:
buildType: specific
buildVersionToDownload: specific
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
buildType: current
artifactName: ${{ artifactName }}
downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
- ${{ if eq(parameters.artifactNames, '') }}:
- task: DownloadBuildArtifacts@0
displayName: Download Build Artifacts
inputs:
buildType: specific
buildVersionToDownload: specific
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
buildType: current
downloadType: specific files
itemPattern: "**"
downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
@@ -23,32 +23,23 @@ stages:
- job: publish_symbols
displayName: Symbol Publishing
dependsOn: setupMaestroVars
condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} ))
variables:
- group: DotNet-Symbol-Server-Pats
- name: AzDOProjectName
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- name: AzDOPipelineId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- name: AzDOBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Build Assets
continueOnError: true
displayName: Download Blob Artifacts
inputs:
buildType: specific
buildVersionToDownload: specific
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
downloadType: 'specific'
itemPattern: |
PdbArtifacts/**
BlobArtifacts/**
downloadPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'BlobArtifacts'
continueOnError: true
- task: DownloadBuildArtifacts@0
displayName: Download PDB Artifacts
inputs:
artifactName: 'PDBArtifacts'
continueOnError: true
# This is necessary whenever we want to publish/restore to an AzDO private feed
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
@@ -89,31 +80,28 @@ stages:
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- name: IsStableBuild
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
- name: AzDOProjectName
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- name: AzDOPipelineId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- name: AzDOBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }}))
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Build Assets
continueOnError: true
displayName: Download Package Artifacts
inputs:
buildType: specific
buildVersionToDownload: specific
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
downloadType: 'specific'
itemPattern: |
PackageArtifacts/**
BlobArtifacts/**
AssetManifests/**
downloadPath: '$(Build.ArtifactStagingDirectory)'
buildType: current
artifactName: PackageArtifacts
continueOnError: true
- task: DownloadBuildArtifacts@0
displayName: Download Blob Artifacts
inputs:
buildType: current
artifactName: BlobArtifacts
continueOnError: true
- task: DownloadBuildArtifacts@0
displayName: Download Asset Manifests
inputs:
buildType: current
artifactName: AssetManifests
- task: NuGetToolInstaller@1
displayName: 'Install NuGet.exe'
@@ -166,6 +154,6 @@ stages:
StageLabel: '${{ parameters.stageName }}'
JobLabel: 'AssetsPublishing'
- template: ../../steps/add-build-to-channel.yml
- template: ../../steps/promote-build.yml
parameters:
ChannelId: ${{ parameters.channelId }}
@@ -23,32 +23,23 @@ stages:
- job: publish_symbols
displayName: Symbol Publishing
dependsOn: setupMaestroVars
condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} ))
variables:
- group: DotNet-Symbol-Server-Pats
- name: AzDOProjectName
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- name: AzDOPipelineId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- name: AzDOBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Build Assets
continueOnError: true
displayName: Download Blob Artifacts
inputs:
buildType: specific
buildVersionToDownload: specific
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
downloadType: 'specific'
itemPattern: |
PdbArtifacts/**
BlobArtifacts/**
downloadPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'BlobArtifacts'
continueOnError: true
- task: DownloadBuildArtifacts@0
displayName: Download PDB Artifacts
inputs:
artifactName: 'PDBArtifacts'
continueOnError: true
# This is necessary whenever we want to publish/restore to an AzDO private feed
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
@@ -88,31 +79,29 @@ stages:
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- name: IsStableBuild
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
- name: AzDOProjectName
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- name: AzDOPipelineId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- name: AzDOBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }}))
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }}))
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Build Assets
continueOnError: true
displayName: Download Package Artifacts
inputs:
buildType: specific
buildVersionToDownload: specific
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
downloadType: 'specific'
itemPattern: |
PackageArtifacts/**
BlobArtifacts/**
AssetManifests/**
downloadPath: '$(Build.ArtifactStagingDirectory)'
buildType: current
artifactName: PackageArtifacts
continueOnError: true
- task: DownloadBuildArtifacts@0
displayName: Download Blob Artifacts
inputs:
buildType: current
artifactName: BlobArtifacts
continueOnError: true
- task: DownloadBuildArtifacts@0
displayName: Download Asset Manifests
inputs:
buildType: current
artifactName: AssetManifests
- task: NuGetToolInstaller@1
displayName: 'Install NuGet.exe'
@@ -165,6 +154,6 @@ stages:
StageLabel: '${{ parameters.stageName }}'
JobLabel: 'AssetsPublishing'
- template: ../../steps/add-build-to-channel.yml
- template: ../../steps/promote-build.yml
parameters:
ChannelId: ${{ parameters.channelId }}
@@ -49,10 +49,6 @@ variables:
- name: NetCore_31_Blazor_Features_Channel_Id
value: 531
# .NET Core Experimental
- name: NetCore_Experimental_Channel_Id
value: 562
# Whether the build is internal or not
- name: IsInternalBuild
value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }}
+82 -160
View File
@@ -26,136 +26,97 @@ stages:
- stage: Validate
dependsOn: ${{ parameters.validateDependsOn }}
displayName: Validate
variables:
- template: common-variables.yml
jobs:
- template: setup-maestro-vars.yml
- ${{ if eq(parameters.enableNugetValidation, 'true') }}:
- job:
displayName: NuGet Validation
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Package Artifacts
inputs:
buildType: current
artifactName: PackageArtifacts
- job:
displayName: NuGet Validation
dependsOn: setupMaestroVars
condition: eq( ${{ parameters.enableNugetValidation }}, 'true')
pool:
vmImage: 'windows-2019'
variables:
- name: AzDOProjectName
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- name: AzDOPipelineId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- name: AzDOBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Package Artifacts
inputs:
buildType: specific
buildVersionToDownload: specific
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
artifactName: PackageArtifacts
- task: PowerShell@2
displayName: Validate
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1
arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/
-ToolDestinationPath $(Agent.BuildDirectory)/Extract/
- task: PowerShell@2
displayName: Validate
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1
arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/
-ToolDestinationPath $(Agent.BuildDirectory)/Extract/
- ${{ if eq(parameters.enableSigningValidation, 'true') }}:
- job:
displayName: Signing Validation
variables:
- template: common-variables.yml
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Package Artifacts
inputs:
buildType: current
artifactName: PackageArtifacts
- job:
displayName: Signing Validation
dependsOn: setupMaestroVars
condition: eq( ${{ parameters.enableSigningValidation }}, 'true')
variables:
- template: common-variables.yml
- name: AzDOProjectName
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- name: AzDOPipelineId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- name: AzDOBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Package Artifacts
inputs:
buildType: specific
buildVersionToDownload: specific
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
artifactName: PackageArtifacts
# This is necessary whenever we want to publish/restore to an AzDO private feed
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
# otherwise it'll complain about accessing a private feed.
- task: NuGetAuthenticate@0
displayName: 'Authenticate to AzDO Feeds'
# This is necessary whenever we want to publish/restore to an AzDO private feed
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
# otherwise it'll complain about accessing a private feed.
- task: NuGetAuthenticate@0
displayName: 'Authenticate to AzDO Feeds'
- task: PowerShell@2
displayName: Enable cross-org publishing
inputs:
filePath: eng\common\enable-cross-org-publishing.ps1
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
- task: PowerShell@2
displayName: Enable cross-org publishing
inputs:
filePath: eng\common\enable-cross-org-publishing.ps1
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
- task: PowerShell@2
displayName: Validate
inputs:
filePath: eng\common\sdk-task.ps1
arguments: -task SigningValidation -restore -msbuildEngine dotnet
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts'
/p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt'
${{ parameters.signingValidationAdditionalParameters }}
- task: PowerShell@2
displayName: Validate
inputs:
filePath: eng\common\sdk-task.ps1
arguments: -task SigningValidation -restore -msbuildEngine dotnet
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts'
/p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt'
${{ parameters.signingValidationAdditionalParameters }}
- template: ../steps/publish-logs.yml
parameters:
StageLabel: 'Validation'
JobLabel: 'Signing'
- template: ../steps/publish-logs.yml
parameters:
StageLabel: 'Validation'
JobLabel: 'Signing'
- ${{ if eq(parameters.enableSourceLinkValidation, 'true') }}:
- job:
displayName: SourceLink Validation
variables:
- template: common-variables.yml
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Blob Artifacts
inputs:
buildType: current
artifactName: BlobArtifacts
- job:
displayName: SourceLink Validation
dependsOn: setupMaestroVars
condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true')
variables:
- template: common-variables.yml
- name: AzDOProjectName
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- name: AzDOPipelineId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- name: AzDOBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
pool:
vmImage: 'windows-2019'
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Blob Artifacts
inputs:
buildType: specific
buildVersionToDownload: specific
project: $(AzDOProjectName)
pipeline: $(AzDOPipelineId)
buildId: $(AzDOBuildId)
artifactName: BlobArtifacts
- task: PowerShell@2
displayName: Validate
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1
arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/
-ExtractPath $(Agent.BuildDirectory)/Extract/
-GHRepoName $(Build.Repository.Name)
-GHCommit $(Build.SourceVersion)
-SourcelinkCliVersion $(SourceLinkCLIVersion)
continueOnError: true
- task: PowerShell@2
displayName: Validate
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1
arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/
-ExtractPath $(Agent.BuildDirectory)/Extract/
-GHRepoName $(Build.Repository.Name)
-GHCommit $(Build.SourceVersion)
-SourcelinkCliVersion $(SourceLinkCLIVersion)
continueOnError: true
- template: /eng/common/templates/job/execute-sdl.yml
parameters:
enable: ${{ parameters.SDLValidationParameters.enable }}
dependsOn: setupMaestroVars
additionalParameters: ${{ parameters.SDLValidationParameters.params }}
continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }}
artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }}
- ${{ if eq(parameters.SDLValidationParameters.enable, 'true') }}:
- template: /eng/common/templates/job/execute-sdl.yml
parameters:
additionalParameters: ${{ parameters.SDLValidationParameters.params }}
continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }}
artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }}
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
parameters:
@@ -246,43 +207,4 @@ stages:
channelId: 551
transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json'
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json'
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
parameters:
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
dependsOn: ${{ parameters.publishDependsOn }}
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
stageName: 'NETCore_Experimental_Publishing'
channelName: '.NET Core Experimental'
channelId: 562
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json'
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental-symbols/nuget/v3/index.json'
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
parameters:
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
dependsOn: ${{ parameters.publishDependsOn }}
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
stageName: 'Net_Eng_Services_Int_Publish'
channelName: '.NET Eng Services - Int'
channelId: 678
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
parameters:
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
dependsOn: ${{ parameters.publishDependsOn }}
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
stageName: 'Net_Eng_Services_Prod_Publish'
channelName: '.NET Eng Services - Prod'
channelId: 679
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json'
@@ -0,0 +1,25 @@
parameters:
ChannelId: 0
jobs:
- job:
displayName: Promote Build
dependsOn: setupMaestroVars
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.ChannelId }}))
variables:
- name: BARBuildId
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- name: ChannelId
value: ${{ parameters.ChannelId }}
pool:
vmImage: 'windows-2019'
steps:
- task: PowerShell@2
displayName: Add Build to Channel
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/promote-build.ps1
arguments: -BuildId $(BARBuildId)
-ChannelId $(ChannelId)
-MaestroApiAccessToken $(MaestroApiAccessToken)
-MaestroApiEndPoint $(MaestroApiEndPoint)
-MaestroApiVersion $(MaestroApiVersion)
@@ -1,12 +1,6 @@
jobs:
- job: setupMaestroVars
displayName: Setup Maestro Vars
variables:
- template: common-variables.yml
- name: BuildId
value: $[ coalesce(variables.BARBuildId, 0) ]
- name: PromoteToChannelId
value: $[ coalesce(variables.PromoteToMaestroChannelId, 0) ]
pool:
vmImage: 'windows-2019'
steps:
@@ -14,7 +8,6 @@ jobs:
- task: DownloadBuildArtifacts@0
displayName: Download Release Configs
condition: eq(variables.PromoteToChannelId, 0)
inputs:
buildType: current
artifactName: ReleaseConfigs
@@ -26,50 +19,18 @@ jobs:
targetType: inline
script: |
try {
if ($Env:PromoteToChannelId -eq 0) {
$Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt
$Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt
$BarId = $Content | Select -Index 0
$BarId = $Content | Select -Index 0
$Channels = ""
$Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," }
$IsStableBuild = $Content | Select -Index 2
$Channels = ""
$Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," }
$AzureDevOpsProject = $Env:System_TeamProject
$AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId
$AzureDevOpsBuildId = $Env:Build_BuildId
$PromoteToMaestroChannelId = 0
}
else {
$buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}"
$apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]'
$apiHeaders.Add('Accept', 'application/json')
$apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}")
$buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" }
$BarId = $Env:BARBuildId
$Channels = 'None'
#TODO: Fix this once this issue is done: https://github.com/dotnet/arcade/issues/3834
$IsStableBuild = 'False'
$AzureDevOpsProject = $buildInfo.azureDevOpsProject
$AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId
$AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId
$PromoteToMaestroChannelId = $Env:PromoteToMaestroChannelId
}
$IsStableBuild = $Content | Select -Index 2
Write-Host "##vso[task.setvariable variable=BARBuildId;isOutput=true]$BarId"
Write-Host "##vso[task.setvariable variable=InitialChannels;isOutput=true]$Channels"
Write-Host "##vso[task.setvariable variable=IsStableBuild;isOutput=true]$IsStableBuild"
Write-Host "##vso[task.setvariable variable=AzDOProjectName;isOutput=true]$AzureDevOpsProject"
Write-Host "##vso[task.setvariable variable=AzDOPipelineId;isOutput=true]$AzureDevOpsBuildDefinitionId"
Write-Host "##vso[task.setvariable variable=AzDOBuildId;isOutput=true]$AzureDevOpsBuildId"
Write-Host "##vso[task.setvariable variable=PromoteToMaestroChannelId;isOutput=true]$PromoteToMaestroChannelId"
}
catch {
Write-Host $_
@@ -77,5 +38,3 @@ jobs:
Write-Host $_.ScriptStackTrace
exit 1
}
env:
MAESTRO_API_TOKEN: $(MaestroApiAccessToken)
@@ -5,9 +5,9 @@ steps:
- task: PowerShell@2
displayName: Add Build to Channel
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/post-build/add-build-to-channel.ps1
filePath: $(Build.SourcesDirectory)/eng/common/post-build/promote-build.ps1
arguments: -BuildId $(BARBuildId)
-ChannelId ${{ parameters.ChannelId }}
-MaestroApiAccessToken $(MaestroApiAccessToken)
-MaestroApiEndPoint $(MaestroApiEndPoint)
-MaestroApiVersion $(MaestroApiVersion)
-MaestroApiVersion $(MaestroApiVersion)
+1 -1
View File
@@ -18,6 +18,6 @@ steps:
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs'
PublishLocation: Container
ArtifactName: PostBuildLogs
ArtifactName: PostBuilLogs
continueOnError: true
condition: always()
+10 -63
View File
@@ -98,10 +98,7 @@ function Exec-Process([string]$command, [string]$commandArgs) {
}
}
# createSdkLocationFile parameter enables a file being generated under the toolset directory
# which writes the sdk's location into. This is only necessary for cmd --> powershell invocations
# as dot sourcing isn't possible.
function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
function InitializeDotNetCli([bool]$install) {
if (Test-Path variable:global:_DotNetInstallDir) {
return $global:_DotNetInstallDir
}
@@ -151,24 +148,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
$env:DOTNET_INSTALL_DIR = $dotnetRoot
}
# Creates a temporary file under the toolset dir.
# The following code block is protecting against concurrent access so that this function can
# be called in parallel.
if ($createSdkLocationFile) {
do {
$sdkCacheFileTemp = Join-Path $ToolsetDir $([System.IO.Path]::GetRandomFileName())
}
until (!(Test-Path $sdkCacheFileTemp))
Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot
try {
Rename-Item -Force -Path $sdkCacheFileTemp 'sdk.txt'
} catch {
# Somebody beat us
Remove-Item -Path $sdkCacheFileTemp
}
}
# Add dotnet to PATH. This prevents any bare invocation of dotnet in custom
# build steps from using anything other than what we've downloaded.
# It also ensures that VS msbuild will use the downloaded sdk targets.
@@ -188,33 +167,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) {
if (!(Test-Path $installScript)) {
Create-Directory $dotnetRoot
$ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit
$maxRetries = 5
$retries = 1
$uri = "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1"
while($true) {
try {
Write-Host "GET $uri"
Invoke-WebRequest $uri -OutFile $installScript
break
}
catch {
Write-Host "Failed to download '$uri'"
Write-Error $_.Exception.Message -ErrorAction Continue
}
if (++$retries -le $maxRetries) {
$delayInSeconds = [math]::Pow(2, $retries) - 1 # Exponential backoff
Write-Host "Retrying. Waiting for $delayInSeconds seconds before next attempt ($retries of $maxRetries)."
Start-Sleep -Seconds $delayInSeconds
}
else {
throw "Unable to download file in $maxRetries attempts."
}
}
Invoke-WebRequest "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1" -OutFile $installScript
}
return $installScript
@@ -224,12 +177,12 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $arc
InstallDotNet $dotnetRoot $version $architecture
}
function InstallDotNet([string] $dotnetRoot,
[string] $version,
[string] $architecture = '',
[string] $runtime = '',
[bool] $skipNonVersionedFiles = $false,
[string] $runtimeSourceFeed = '',
function InstallDotNet([string] $dotnetRoot,
[string] $version,
[string] $architecture = '',
[string] $runtime = '',
[bool] $skipNonVersionedFiles = $false,
[string] $runtimeSourceFeed = '',
[string] $runtimeSourceFeedKey = '') {
$installScript = GetDotNetInstallScript $dotnetRoot
@@ -263,10 +216,7 @@ function InstallDotNet([string] $dotnetRoot,
}
catch {
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'."
ExitWithExitCode 1
}
} else {
ExitWithExitCode 1
}
}
}
@@ -297,7 +247,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
if ($msbuildCmd -ne $null) {
# Workaround for https://github.com/dotnet/roslyn/issues/35793
# Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+
$msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split([char[]]@('-', '+'))[0])
$msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split(@('-', '+'))[0])
if ($msbuildVersion -ge $vsMinVersion) {
return $global:_MSBuildExe = $msbuildCmd.Path
@@ -325,10 +275,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
$xcopyMSBuildVersion = "$vsMajorVersion.$($vsMinVersion.Minor).0-alpha"
}
$vsInstallDir = $null
if ($xcopyMSBuildVersion.Trim() -ine "none") {
$vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install
}
$vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install
if ($vsInstallDir -eq $null) {
throw 'Unable to find Visual Studio that has required version and components installed'
}
+8 -32
View File
@@ -41,7 +41,7 @@ fi
# Configures warning treatment in msbuild.
warn_as_error=${warn_as_error:-true}
# True to attempt using .NET Core already that meets requirements specified in global.json
# True to attempt using .NET Core already that meets requirements specified in global.json
# installed on the machine instead of downloading one.
use_installed_dotnet_cli=${use_installed_dotnet_cli:-true}
@@ -172,7 +172,7 @@ function InstallDotNetSdk {
function InstallDotNet {
local root=$1
local version=$2
GetDotNetInstallScript "$root"
local install_script=$_GetDotNetInstallScript
@@ -211,35 +211,11 @@ function InstallDotNet {
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from custom location '$runtimeSourceFeed' (exit code '$exit_code')."
ExitWithExitCode $exit_code
}
else
ExitWithExitCode $exit_code
fi
fi
}
}
function with_retries {
local maxRetries=5
local retries=1
echo "Trying to run '$@' for maximum of $maxRetries attempts."
while [[ $((retries++)) -le $maxRetries ]]; do
"$@"
if [[ $? == 0 ]]; then
echo "Ran '$@' successfully."
return 0
fi
timeout=$((2**$retries-1))
echo "Failed to execute '$@'. Waiting $timeout seconds before next attempt ($retries out of $maxRetries)." 1>&2
sleep $timeout
done
echo "Failed to execute '$@' for $maxRetries times." 1>&2
return 1
}
function GetDotNetInstallScript {
local root=$1
local install_script="$root/dotnet-install.sh"
@@ -252,13 +228,13 @@ function GetDotNetInstallScript {
# Use curl if available, otherwise use wget
if command -v curl > /dev/null; then
with_retries curl "$install_script_url" -isSLv --retry 10 --create-dirs -o "$install_script" || {
curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || {
local exit_code=$?
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
ExitWithExitCode $exit_code
}
else
with_retries wget -v -O "$install_script" "$install_script_url" || {
else
wget -q -O "$install_script" "$install_script_url" || {
local exit_code=$?
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
ExitWithExitCode $exit_code
@@ -273,11 +249,11 @@ function InitializeBuildTool {
if [[ -n "${_InitializeBuildTool:-}" ]]; then
return
fi
InitializeDotNetCli $restore
# return values
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
_InitializeBuildToolCommand="msbuild"
_InitializeBuildToolFramework="netcoreapp2.1"
}
@@ -341,7 +317,7 @@ function InitializeToolset {
if [[ "$binary_log" == true ]]; then
bl="/bl:$log_dir/ToolsetRestore.binlog"
fi
echo '<Project Sdk="Microsoft.DotNet.Arcade.Sdk"/>' > "$proj"
MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file"
+1 -1
+1 -1
+1 -1
+3 -3
View File
@@ -1,9 +1,9 @@
{
"tools": {
"dotnet": "5.0.100-alpha1-015772"
"dotnet": "5.0.100-alpha1-014854"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20109.1",
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20109.1"
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19574.1",
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.19574.1"
}
}
+97 -97
View File
@@ -1,98 +1,98 @@
:: Set up build environment and build LLVM using MSVC and msbuild targets in mono.sln.
:: Arguments:
:: -------------------------------------------------------
:: %1 Visual Studio target, build|clean, default build
:: %2 Host CPU architecture, x86_64|i686, default x86_64
:: %3 Visual Studio configuration, debug|release, default release
:: %4 Mono MSVC source folder.
:: %5 LLVM build directory.
:: %6 LLVM install directory.
:: %7 Additional arguments passed to msbuild, needs to be quoted if multiple.
:: -------------------------------------------------------
@echo off
setlocal
set BUILD_RESULT=1
:: Get path for current running script.
set RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH=%~dp0
:: Configure all known build arguments.
set VS_BUILD_ARGS=
set VS_TARGET=build
if /i "%~1" == "clean" (
set VS_TARGET="clean"
)
shift
set VS_PLATFORM=x64
if /i "%~1" == "i686" (
set VS_PLATFORM="Win32"
)
if /i "%~1" == "win32" (
set VS_PLATFORM="Win32"
)
shift
set VS_CONFIGURATION=Release
if /i "%~1" == "debug" (
set VS_CONFIGURATION="Debug"
)
shift
set MONO_MSVC_SOURCE_DIR=%RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH%..\msvc\
if not "%~1" == "" (
set MONO_MSVC_SOURCE_DIR=%~1
)
shift
set MONO_LLVM_BUILD_DIR=
if not "%~1" == "" (
set MONO_LLVM_BUILD_DIR=%~1
)
shift
set MONO_LLVM_INSTALL_DIR=
if not "%~1" == "" (
set MONO_LLVM_INSTALL_DIR=%~1
)
shift
set VS_ADDITIONAL_ARGUMENTS=
if not "%~1" == "" (
set VS_ADDITIONAL_ARGUMENTS=%~1
)
:: Setup Windows environment.
call %MONO_MSVC_SOURCE_DIR%setup-windows-env.bat
:: Setup VS msbuild environment.
call %MONO_MSVC_SOURCE_DIR%setup-vs-msbuild-env.bat
if "%VS_ADDITIONAL_ARGUMENTS%" == "" (
set "VS_ADDITIONAL_ARGUMENTS=/p:PlatformToolset=%VS_DEFAULT_PLATFORM_TOOL_SET% /p:MONO_TARGET_GC=sgen"
)
if not "%MONO_LLVM_BUILD_DIR%" == "" (
set VS_BUILD_ARGS=/p:_LLVMBuildDir="%MONO_LLVM_BUILD_DIR%"
)
if not "%MONO_LLVM_INSTALL_DIR%" == "" (
set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:_LLVMInstallDir="%MONO_LLVM_INSTALL_DIR%"
)
set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:MONO_ENABLE_LLVM=true /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% %VS_ADDITIONAL_ARGUMENTS% /t:%VS_TARGET% /m
call msbuild.exe %VS_BUILD_ARGS% "%MONO_MSVC_SOURCE_DIR%build-external-llvm.vcxproj" && (
set BUILD_RESULT=0
) || (
set BUILD_RESULT=1
if not %ERRORLEVEL% == 0 (
set BUILD_RESULT=%ERRORLEVEL%
)
)
exit /b %BUILD_RESULT%
:: Set up build environment and build LLVM using MSVC and msbuild targets in mono.sln.
:: Arguments:
:: -------------------------------------------------------
:: %1 Visual Studio target, build|clean, default build
:: %2 Host CPU architecture, x86_64|i686, default x86_64
:: %3 Visual Studio configuration, debug|release, default release
:: %4 Mono MSVC source folder.
:: %5 LLVM build directory.
:: %6 LLVM install directory.
:: %7 Additional arguments passed to msbuild, needs to be quoted if multiple.
:: -------------------------------------------------------
@echo off
setlocal
set BUILD_RESULT=1
:: Get path for current running script.
set RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH=%~dp0
:: Configure all known build arguments.
set VS_BUILD_ARGS=
set VS_TARGET=build
if /i "%~1" == "clean" (
set VS_TARGET="clean"
)
shift
set VS_PLATFORM=x64
if /i "%~1" == "i686" (
set VS_PLATFORM="Win32"
)
if /i "%~1" == "win32" (
set VS_PLATFORM="Win32"
)
shift
set VS_CONFIGURATION=Release
if /i "%~1" == "debug" (
set VS_CONFIGURATION="Debug"
)
shift
set MONO_MSVC_SOURCE_DIR=%RUN_BUILD_LLVM_MSBUILD_SCRIPT_PATH%..\msvc\
if not "%~1" == "" (
set MONO_MSVC_SOURCE_DIR=%~1
)
shift
set MONO_LLVM_BUILD_DIR=
if not "%~1" == "" (
set MONO_LLVM_BUILD_DIR=%~1
)
shift
set MONO_LLVM_INSTALL_DIR=
if not "%~1" == "" (
set MONO_LLVM_INSTALL_DIR=%~1
)
shift
set VS_ADDITIONAL_ARGUMENTS=
if not "%~1" == "" (
set VS_ADDITIONAL_ARGUMENTS=%~1
)
:: Setup Windows environment.
call %MONO_MSVC_SOURCE_DIR%setup-windows-env.bat
:: Setup VS msbuild environment.
call %MONO_MSVC_SOURCE_DIR%setup-vs-msbuild-env.bat
if "%VS_ADDITIONAL_ARGUMENTS%" == "" (
set "VS_ADDITIONAL_ARGUMENTS=/p:PlatformToolset=%VS_DEFAULT_PLATFORM_TOOL_SET% /p:MONO_TARGET_GC=sgen"
)
if not "%MONO_LLVM_BUILD_DIR%" == "" (
set VS_BUILD_ARGS=/p:_LLVMBuildDir="%MONO_LLVM_BUILD_DIR%"
)
if not "%MONO_LLVM_INSTALL_DIR%" == "" (
set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:_LLVMInstallDir="%MONO_LLVM_INSTALL_DIR%"
)
set VS_BUILD_ARGS=%VS_BUILD_ARGS% /p:MONO_ENABLE_LLVM=true /p:Configuration=%VS_CONFIGURATION% /p:Platform=%VS_PLATFORM% %VS_ADDITIONAL_ARGUMENTS% /t:%VS_TARGET% /m
call msbuild.exe %VS_BUILD_ARGS% "%MONO_MSVC_SOURCE_DIR%build-external-llvm.vcxproj" && (
set BUILD_RESULT=0
) || (
set BUILD_RESULT=1
if not %ERRORLEVEL% == 0 (
set BUILD_RESULT=%ERRORLEVEL%
)
)
exit /b %BUILD_RESULT%
@echo on
+2
View File
@@ -14,6 +14,7 @@ AC_DEFUN([AC_MONO_OUTPUT], [
AC_OUTPUT([
Makefile
llvm/Makefile
mk/Makefile
mono/Makefile
mono/btls/Makefile
mono/native/Makefile
@@ -97,5 +98,6 @@ AC_DEFUN([AC_MONO_OUTPUT], [
tools/mono-hang-watchdog/Makefile
runtime/Makefile
po/Makefile
netcore/corerun/Makefile
])
])
+9 -5
View File
@@ -860,11 +860,9 @@ Instruct the runtime on the number of times that the method specified
by --compile (or all the methods if --compile-all is used) to be
compiled. This is used for testing the code generator performance.
.TP
\fB--stats=[method]\fR
\fB--stats\fR
Displays information about the work done by the runtime during the
execution of an application. If a method (namespace.name:methodname)
is specified, it will display that information when the method is
first run in addition to the end of program execution.
execution of an application.
.TP
\fB--wapi=hps|semdel\fR
Perform maintenance of the process shared data.
@@ -1498,6 +1496,9 @@ scanning is available.
\fBno-managed-allocator\fR
Disables the managed allocator.
.TP
\fBmanaged-allocator\fR
Enables the managed allocator.
.TP
\fBcheck-scan-starts\fR
If set, does a plausibility check on the scan_starts before and after each collection
.TP
@@ -1523,7 +1524,10 @@ sgen-gc.c. You can then use this command to explore the output
\fBnursery-canaries\fR
If set, objects allocated in the nursery are suffixed with a canary (guard)
word, which is checked on each minor collection. Can be used to detect/debug
heap corruption issues.
heap corruption issues. This disables the usage of the managed allocator,
because allocation from full aot code is inconsistent with this option. If
the application is guaranteed not to use aot code, the managed allocator can
be enabled back with managed-allocator option.
.TP
\fBdo-not-finalize(=\fIclasses\fB)\fR
@@ -52,6 +52,8 @@ namespace Mono.CompilerServices.SymbolWriter
#if !CECIL && !MOBILE
ModuleBuilder mb;
delegate Guid GetGuidFunc (ModuleBuilder mb);
GetGuidFunc get_guid_func;
public SymbolWriterImpl (ModuleBuilder mb)
{
@@ -60,7 +62,16 @@ namespace Mono.CompilerServices.SymbolWriter
public void Close ()
{
msw.WriteSymbolFile (mb.ModuleVersionId);
MethodInfo mi = typeof (ModuleBuilder).GetMethod (
"Mono_GetGuid",
BindingFlags.Static | BindingFlags.NonPublic);
if (mi == null)
return;
get_guid_func = (GetGuidFunc) System.Delegate.CreateDelegate (
typeof (GetGuidFunc), mi);
msw.WriteSymbolFile (get_guid_func (mb));
}
#else
Guid guid;
@@ -51,19 +51,10 @@ namespace Mono.Debugger.Soft
// Since protocol version 2.46
public Value Value {
get {
ValueImpl value;
if (Address == 0)
return null;
try {
value = vm.conn.Pointer_GetValue (Address, Type);
}
catch (CommandException ex) {
if (ex.ErrorCode == ErrorCode.INVALID_ARGUMENT)
throw new ArgumentException ("Invalid pointer address.");
else
throw;
}
return vm.DecodeValue (value);
return vm.DecodeValue (vm.conn.Pointer_GetValue (Address, Type));
}
}
@@ -609,10 +609,6 @@ public class Tests : TestsBase, ITest2
fixed_size_array();
test_new_exception_filter();
test_async_debug_generics();
if (args.Length >0 && args [0] == "pointer_arguments2") {
pointers2 ();
return 0;
}
return 3;
}
@@ -2236,17 +2232,6 @@ public class Tests : TestsBase, ITest2
rtMethod.Invoke(rtObject, new object[] { });
}
public static unsafe void pointer_arguments2 (int* a) {
*a = 0;
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static unsafe void pointers2 () {
int[] a = new [] {1,2,3};
fixed (int* pa = a)
pointer_arguments2 (pa);
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void new_thread_hybrid_exception() {
try
@@ -470,7 +470,6 @@ public class DebuggerTests
var pdbFromMemory = assemblyMirror.GetPdbBlob ();
if (!File.Exists (pdbPath)) {
Assert.IsFalse (assemblyMirror.HasPdb);
Assert.IsTrue (assemblyMirror.HasFetchedPdb);
continue;
}
@@ -5174,32 +5173,6 @@ public class DebuggerTests
e = step_in_await ("MoveNext", e);
e = step_in_await ("MoveNext", e);
}
[Test]
public void InvalidPointer_GetValue () {
vm.Detach ();
Start (dtest_app_path, "pointer_arguments2");
Event e = run_until ("pointer_arguments2");
var frame = e.Thread.GetFrames () [0];
var param = frame.Method.GetParameters()[0];
Assert.AreEqual("Int32*", param.ParameterType.Name);
var pointerValue = frame.GetValue(param) as PointerValue;
Assert.AreEqual("Int32*", pointerValue.Type.Name);
var pointerValue2 = new PointerValue (pointerValue.VirtualMachine, pointerValue.Type, 200);
try {
var val = pointerValue2.Value;
}
catch (ArgumentException ex) {
Assert.IsInstanceOfType (typeof (ArgumentException), ex);
}
}
#endif
} // class DebuggerTests
@@ -311,8 +311,8 @@ public class UnixEncoding : Encoding
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
{
if ((bytes == null && byteCount != 0) || (chars == null && charCount != 0))
throw new ArgumentNullException ((bytes == null && byteCount != 0) ? "bytes" : "chars");
if (bytes == null || chars == null)
throw new ArgumentNullException (bytes == null ? "bytes" : "chars");
if (charCount < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException (charCount < 0 ? "charCount" : "byteCount");
@@ -995,23 +995,6 @@ namespace MonoTests.Mono.Unix {
);
}
[Test]
public void TestEmptyString ()
{
byte[] data = new byte [] {};
Encoding enc = new UnixEncoding ();
string s = enc.GetString (data);
Assert.AreEqual (s, "", "#1");
char[] chars = enc.GetChars (data);
Assert.AreEqual (chars.Length, 0, "#2");
byte[] b1 = enc.GetBytes ("");
Assert.AreEqual (b1.Length, 0, "#3");
byte[] b2 = enc.GetBytes (new char[] {});
Assert.AreEqual (b2.Length, 0, "#3");
}
private void Compare (string prefix, string start, byte[] end)
{
byte[] bytes = unix.GetBytes (start);
@@ -508,7 +508,7 @@ namespace MonoTests.Mono.Profiler.Log {
});
}
[Fact]
[Fact (Skip = "https://github.com/mono/mono/issues/8709")]
public void HeapshotDataIsValid ()
{
new ProfilerTestRun ("simple-allocation", "heapshot").Run (events => {
@@ -1,22 +1,22 @@
@echo off
echo This batch will throw some errors, if the user already exists or
echo the database does not exist. You can safely ignore those
echo.
echo You should run this as the installation owner (the user, that installed Ingres)
echo.
echo Tested on Ingres 9.2.0 Build 118
echo Trying to drop database northwind...
destroydb northwind -uLinqUser > nwind.log
echo Creating user LinqUser...
sql iidbdb < create_User.sql >> nwind.log
echo Creating database northwind...
createdb northwind -uLinqUser >> nwind.log
echo Filling data into northwind...
sql northwind -uLinqUser < create_Northwind.sql >> nwind.log
echo Done.
pause
@echo off
echo This batch will throw some errors, if the user already exists or
echo the database does not exist. You can safely ignore those
echo.
echo You should run this as the installation owner (the user, that installed Ingres)
echo.
echo Tested on Ingres 9.2.0 Build 118
echo Trying to drop database northwind...
destroydb northwind -uLinqUser > nwind.log
echo Creating user LinqUser...
sql iidbdb < create_User.sql >> nwind.log
echo Creating database northwind...
createdb northwind -uLinqUser >> nwind.log
echo Filling data into northwind...
sql northwind -uLinqUser < create_Northwind.sql >> nwind.log
echo Done.
pause
@@ -1,3 +1,3 @@
REM you need to have DbMetal.exe compiled in the standard directory
REM you need to have DbMetal.exe compiled in the standard directory
..\..\..\DbMetal\bin\DbMetal.exe -Provider=MySql -server:localhost -user:LinqUser -password:linq2 -database:AllTypes -namespace:AllTypesExample -code:AllTypes.cs
@@ -1,5 +1,5 @@
REM: note that the '-sprocs' option is turned on
..\..\..\SqlMetal\bin\MySqlMetal.exe -database:Andrus -server:localhost -user:LinqUser -password:linq2 -namespace:andrusDB -code:..\nwind\Andrus.cs -sprocs
REM: note that the '-sprocs' option is turned on
..\..\..\SqlMetal\bin\MySqlMetal.exe -database:Andrus -server:localhost -user:LinqUser -password:linq2 -namespace:andrusDB -code:..\nwind\Andrus.cs -sprocs
@@ -0,0 +1,27 @@
using System.Reflection;
namespace System.Net.Http
{
partial class HttpClientHandler : HttpMessageHandler
{
static IMonoHttpClientHandler CreateDefaultHandler ()
{
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
if (envvar?.StartsWith("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
{
Type monoWrhType = Type.GetType (envvar, false);
if (monoWrhType != null)
return (IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType);
}
// Ignore other types of handlers here (e.g. AndroidHttpHandler) to keep the old behavior
// and always create SocketsHttpHandler for code like this if MonoWebRequestHandler was not specified:
//
// var handler = new HttpClientHandler { Credentials = ... };
// var httpClient = new HttpClient (handler);
//
// AndroidHttpHandler is used only when we use the parameterless ctor of HttpClient
return new SocketsHttpHandler ();
}
}
}
@@ -70,7 +70,7 @@ namespace System.Net.Http
TimeSpan? timeout;
bool disposed;
internal MonoWebRequestHandler ()
public MonoWebRequestHandler ()
{
allowAutoRedirect = true;
maxAutomaticRedirections = 50;
@@ -1328,7 +1328,7 @@
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StreamContent.cs" />
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StreamToStreamCopy.cs" />
<Compile Include="..\..\..\external\corefx\src\System.Net.Http\src\System\Net\Http\StringContent.cs" />
<Compile Include="HttpClientHandler.SocketsHandler.cs" />
<Compile Include="HttpClientHandler.SocketsHandler.Android.cs" />
<Compile Include="HttpClientHandler.cs" />
<Compile Include="HttpRequestMessage.Mono.cs" />
<Compile Include="IMonoHttpClientHandler.cs" />
@@ -8,27 +8,34 @@ namespace System.Net.Http {
static HttpMessageHandler CreateDefaultHandler ()
{
Type type = Type.GetType("Android.Runtime.AndroidEnvironment, Mono.Android");
if (type == null)
return GetFallback ("Invalid Mono.Android assembly? Cannot find Android.Runtime.AndroidEnvironment");
string envvar = Environment.GetEnvironmentVariable ("XA_HTTP_CLIENT_HANDLER_TYPE")?.Trim ();
MethodInfo method = type.GetMethod ("GetHttpMessageHandler", BindingFlags.Static | BindingFlags.NonPublic);
if (method == null)
return GetFallback ("Your Xamarin.Android version does not support obtaining of the custom HttpClientHandler");
if (string.IsNullOrEmpty (envvar))
return new HttpClientHandler ();
object ret = method.Invoke (null, null);
if (ret == null)
return GetFallback ("Xamarin.Android returned no custom HttpClientHandler");
if (envvar?.StartsWith ("System.Net.Http.MonoWebRequestHandler", StringComparison.InvariantCulture) == true)
{
Type monoWrhType = Type.GetType (envvar, false);
if (monoWrhType != null)
return new HttpClientHandler ((IMonoHttpClientHandler) Activator.CreateInstance (monoWrhType));
var handler = ret as HttpMessageHandler;
if (handler == null)
return GetFallback ($"{ret?.GetType()} is not a valid HttpMessageHandler");
return handler;
}
return new HttpClientHandler ();
}
Type handlerType = Type.GetType (envvar, false);
if (handlerType == null && !envvar.Contains (", "))
{
// if assembly was not specified - look for it in Mono.Android too
// (e.g. AndroidHttpHandler is there)
handlerType = Type.GetType (envvar + ", Mono.Android", false);
}
if (handlerType == null)
return new HttpClientHandler ();
if (Activator.CreateInstance (handlerType) is HttpMessageHandler msgHandler)
return msgHandler;
static HttpMessageHandler GetFallback (string message)
{
Console.WriteLine (message + ". Defaulting to System.Net.Http.HttpClientHandler");
return new HttpClientHandler ();
}
}
@@ -1 +1,2 @@
HttpClient.DefaultHandler.cs
HttpClientHandler.SocketsHandler.cs
@@ -1,2 +1,3 @@
#include socketshandler.sources
System.Net.Http/HttpClient.android.cs
HttpClientHandler.SocketsHandler.Android.cs
@@ -423,8 +423,10 @@ namespace System.Runtime.Serialization.Json
XmlDictionaryString namespaceLocal = null;
if (nameLocal != null && nameLocal is string)
writer.WriteStartElement ((string) name, null);
else
else if (name is XmlDictionaryString)
writer.WriteStartElement ((XmlDictionaryString) name, null);
else
writer.WriteStartElement (name.ToString(), null);
}
void WriteEndElement ()
@@ -21,7 +21,7 @@
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>XML Web services discovery involves discovering the available Web Services given an URL. The URL usually points to a discovery document, which typically has a.disco file name extension. Within a discovery document are references to information about the existence of XML Web services. These references can refer to service descriptions, XML Schema Definition language (XSD) schemas or other discovery documents. This class represents a reference to a Service Description.</para>
<para>XML Web services discovery involves discovering the available Web Services given an URL. The URL usually points to a discovery document, which typically has a.disco file name extension. Within a discovery document are references to information about the existance of XML Web services. These references can refer to service descriptions, XML Schema Definition language (XSD) schemas or other discovery documents. This class represents a reference to a Service Description.</para>
<para>Within a discovery document, a reference to a Service Description is contained within a contractRef XML element. The contractRef XML element has two attributes: ref and docRef. The contractRef element must have an XML namespace matching the <see cref="F:System.Web.Services.Discovery.ContractReference.Namespace" /> constant, whereas the ref and docRef attributes are placed in the <see cref="P:System.Web.Services.Discovery.ContractReference.Ref" /> and <see cref="P:System.Web.Services.Discovery.ContractReference.DocRef" /> properties.</para>
</remarks>
<summary>
@@ -21,7 +21,7 @@
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>XML Web services discovery involves discovering the available XML Web services, given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document, which is an XML document, contains references to information about the existence of XML Web services, such as a service description, XML Schema Definition (XSD) language schema, or another discovery document. This class represents the contents of the discovery document; where the <see cref="P:System.Web.Services.Discovery.DiscoveryDocument.References" /> property contains a list of the references contained within the discovery document.</para>
<para>XML Web services discovery involves discovering the available XML Web services, given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document, which is an XML document, contains references to information about the existance of XML Web services, such as a service description, XML Schema Definition (XSD) language schema, or another discovery document. This class represents the contents of the discovery document; where the <see cref="P:System.Web.Services.Discovery.DiscoveryDocument.References" /> property contains a list of the references contained within the discovery document.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
@@ -21,7 +21,7 @@
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>XML Web services discovery involves discovering the available XML Web services given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existence of XML Web services, such as Service Descriptions, XML Schema Definition language (XSD) schemas, or other discovery documents. This class represents a reference to a discovery document.</para>
<para>XML Web services discovery involves discovering the available XML Web services given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existance of XML Web services, such as Service Descriptions, XML Schema Definition language (XSD) schemas, or other discovery documents. This class represents a reference to a discovery document.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
@@ -21,7 +21,7 @@
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>XML Web services discovery involves discovering the available XML Web services given, a URL. A The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existence of XML Web services. These references can refer to service descriptions, XSD schemas, or other discovery documents. This class represents a reference to an XSD schema.</para>
<para>XML Web services discovery involves discovering the available XML Web services given, a URL. A The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existance of XML Web services. These references can refer to service descriptions, XSD schemas, or other discovery documents. This class represents a reference to an XSD schema.</para>
<para>Within a discovery document, a reference to an XSD schema is contained within a schemaRef XML element. The schemaRef XML element has an XML namespace and a ref attribute. The value of the XML namespace must match the <see cref="F:System.Web.Services.Discovery.SchemaReference.Namespace" /> constant. The value of the ref attribute is placed in the <see cref="P:System.Web.Services.Discovery.SchemaReference.Ref" /> property.</para>
</remarks>
<summary>
@@ -0,0 +1,413 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok ([email protected])
//
//
// COMPLETE
using System.Collections;
namespace System.Windows.Forms.RTF {
internal class Charcode {
#region Local Variables
private StandardCharCode[] codes;
private Hashtable reverse;
private int size;
#endregion // Local Variables
#region Cached Values
static Charcode ansi_generic;
#endregion
#region Public Constructors
public Charcode() : this(256) {
}
private Charcode(int size) {
this.size = size;
this.codes = new StandardCharCode[size];
this.reverse = new Hashtable(size);
// No need to reinitialize array to its default value
//for (int i = 0; i < size; i++) {
// codes[i] = StandardCharCode.nothing;
//}
}
#endregion // Public Constructors
#region Public Instance Properties
public int this[StandardCharCode c] {
get {
object obj;
obj = reverse[c];
if (obj != null) {
return (int)obj;
}
for (int i = 0; i < size; i++) {
if (codes[i] == c) {
return i;
}
}
return -1;
}
}
public StandardCharCode this[int c] {
get {
if (c < 0 || c >= size) {
return StandardCharCode.nothing;
}
return codes[c];
}
private set {
if (c < 0 || c >= size) {
return;
}
codes[c] = value;
reverse[value] = c;
}
}
#endregion // Public Instance Properties
#region Public Instance Methods
#endregion // Public Instance Methods
#region Public Static Methods
public static Charcode AnsiGeneric {
get {
if (ansi_generic != null)
return ansi_generic;
ansi_generic = new Charcode(256);
ansi_generic[0x06] = StandardCharCode.formula;
ansi_generic[0x1e] = StandardCharCode.nobrkhyphen;
ansi_generic[0x1f] = StandardCharCode.opthyphen;
ansi_generic[' '] = StandardCharCode.space;
ansi_generic['!'] = StandardCharCode.exclam;
ansi_generic['"'] = StandardCharCode.quotedbl;
ansi_generic['#'] = StandardCharCode.numbersign;
ansi_generic['$'] = StandardCharCode.dollar;
ansi_generic['%'] = StandardCharCode.percent;
ansi_generic['&'] = StandardCharCode.ampersand;
ansi_generic['\\'] = StandardCharCode.quoteright;
ansi_generic['('] = StandardCharCode.parenleft;
ansi_generic[')'] = StandardCharCode.parenright;
ansi_generic['*'] = StandardCharCode.asterisk;
ansi_generic['+'] = StandardCharCode.plus;
ansi_generic[','] = StandardCharCode.comma;
ansi_generic['-'] = StandardCharCode.hyphen;
ansi_generic['.'] = StandardCharCode.period;
ansi_generic['/'] = StandardCharCode.slash;
ansi_generic['0'] = StandardCharCode.zero;
ansi_generic['1'] = StandardCharCode.one;
ansi_generic['2'] = StandardCharCode.two;
ansi_generic['3'] = StandardCharCode.three;
ansi_generic['4'] = StandardCharCode.four;
ansi_generic['5'] = StandardCharCode.five;
ansi_generic['6'] = StandardCharCode.six;
ansi_generic['7'] = StandardCharCode.seven;
ansi_generic['8'] = StandardCharCode.eight;
ansi_generic['9'] = StandardCharCode.nine;
ansi_generic[':'] = StandardCharCode.colon;
ansi_generic[';'] = StandardCharCode.semicolon;
ansi_generic['<'] = StandardCharCode.less;
ansi_generic['='] = StandardCharCode.equal;
ansi_generic['>'] = StandardCharCode.greater;
ansi_generic['?'] = StandardCharCode.question;
ansi_generic['@'] = StandardCharCode.at;
ansi_generic['A'] = StandardCharCode.A;
ansi_generic['B'] = StandardCharCode.B;
ansi_generic['C'] = StandardCharCode.C;
ansi_generic['D'] = StandardCharCode.D;
ansi_generic['E'] = StandardCharCode.E;
ansi_generic['F'] = StandardCharCode.F;
ansi_generic['G'] = StandardCharCode.G;
ansi_generic['H'] = StandardCharCode.H;
ansi_generic['I'] = StandardCharCode.I;
ansi_generic['J'] = StandardCharCode.J;
ansi_generic['K'] = StandardCharCode.K;
ansi_generic['L'] = StandardCharCode.L;
ansi_generic['M'] = StandardCharCode.M;
ansi_generic['N'] = StandardCharCode.N;
ansi_generic['O'] = StandardCharCode.O;
ansi_generic['P'] = StandardCharCode.P;
ansi_generic['Q'] = StandardCharCode.Q;
ansi_generic['R'] = StandardCharCode.R;
ansi_generic['S'] = StandardCharCode.S;
ansi_generic['T'] = StandardCharCode.T;
ansi_generic['U'] = StandardCharCode.U;
ansi_generic['V'] = StandardCharCode.V;
ansi_generic['W'] = StandardCharCode.W;
ansi_generic['X'] = StandardCharCode.X;
ansi_generic['Y'] = StandardCharCode.Y;
ansi_generic['Z'] = StandardCharCode.Z;
ansi_generic['['] = StandardCharCode.bracketleft;
ansi_generic['\\'] = StandardCharCode.backslash;
ansi_generic[']'] = StandardCharCode.bracketright;
ansi_generic['^'] = StandardCharCode.asciicircum;
ansi_generic['_'] = StandardCharCode.underscore;
ansi_generic['`'] = StandardCharCode.quoteleft;
ansi_generic['a'] = StandardCharCode.a;
ansi_generic['b'] = StandardCharCode.b;
ansi_generic['c'] = StandardCharCode.c;
ansi_generic['d'] = StandardCharCode.d;
ansi_generic['e'] = StandardCharCode.e;
ansi_generic['f'] = StandardCharCode.f;
ansi_generic['g'] = StandardCharCode.g;
ansi_generic['h'] = StandardCharCode.h;
ansi_generic['i'] = StandardCharCode.i;
ansi_generic['j'] = StandardCharCode.j;
ansi_generic['k'] = StandardCharCode.k;
ansi_generic['l'] = StandardCharCode.l;
ansi_generic['m'] = StandardCharCode.m;
ansi_generic['n'] = StandardCharCode.n;
ansi_generic['o'] = StandardCharCode.o;
ansi_generic['p'] = StandardCharCode.p;
ansi_generic['q'] = StandardCharCode.q;
ansi_generic['r'] = StandardCharCode.r;
ansi_generic['s'] = StandardCharCode.s;
ansi_generic['t'] = StandardCharCode.t;
ansi_generic['u'] = StandardCharCode.u;
ansi_generic['v'] = StandardCharCode.v;
ansi_generic['w'] = StandardCharCode.w;
ansi_generic['x'] = StandardCharCode.x;
ansi_generic['y'] = StandardCharCode.y;
ansi_generic['z'] = StandardCharCode.z;
ansi_generic['{'] = StandardCharCode.braceleft;
ansi_generic['|'] = StandardCharCode.bar;
ansi_generic['}'] = StandardCharCode.braceright;
ansi_generic['~'] = StandardCharCode.asciitilde;
ansi_generic[0xa0] = StandardCharCode.nobrkspace;
ansi_generic[0xa1] = StandardCharCode.exclamdown;
ansi_generic[0xa2] = StandardCharCode.cent;
ansi_generic[0xa3] = StandardCharCode.sterling;
ansi_generic[0xa4] = StandardCharCode.currency;
ansi_generic[0xa5] = StandardCharCode.yen;
ansi_generic[0xa6] = StandardCharCode.brokenbar;
ansi_generic[0xa7] = StandardCharCode.section;
ansi_generic[0xa8] = StandardCharCode.dieresis;
ansi_generic[0xa9] = StandardCharCode.copyright;
ansi_generic[0xaa] = StandardCharCode.ordfeminine;
ansi_generic[0xab] = StandardCharCode.guillemotleft;
ansi_generic[0xac] = StandardCharCode.logicalnot;
ansi_generic[0xad] = StandardCharCode.opthyphen;
ansi_generic[0xae] = StandardCharCode.registered;
ansi_generic[0xaf] = StandardCharCode.macron;
ansi_generic[0xb0] = StandardCharCode.degree;
ansi_generic[0xb1] = StandardCharCode.plusminus;
ansi_generic[0xb2] = StandardCharCode.twosuperior;
ansi_generic[0xb3] = StandardCharCode.threesuperior;
ansi_generic[0xb4] = StandardCharCode.acute;
ansi_generic[0xb5] = StandardCharCode.mu;
ansi_generic[0xb6] = StandardCharCode.paragraph;
ansi_generic[0xb7] = StandardCharCode.periodcentered;
ansi_generic[0xb8] = StandardCharCode.cedilla;
ansi_generic[0xb9] = StandardCharCode.onesuperior;
ansi_generic[0xba] = StandardCharCode.ordmasculine;
ansi_generic[0xbb] = StandardCharCode.guillemotright;
ansi_generic[0xbc] = StandardCharCode.onequarter;
ansi_generic[0xbd] = StandardCharCode.onehalf;
ansi_generic[0xbe] = StandardCharCode.threequarters;
ansi_generic[0xbf] = StandardCharCode.questiondown;
ansi_generic[0xc0] = StandardCharCode.Agrave;
ansi_generic[0xc1] = StandardCharCode.Aacute;
ansi_generic[0xc2] = StandardCharCode.Acircumflex;
ansi_generic[0xc3] = StandardCharCode.Atilde;
ansi_generic[0xc4] = StandardCharCode.Adieresis;
ansi_generic[0xc5] = StandardCharCode.Aring;
ansi_generic[0xc6] = StandardCharCode.AE;
ansi_generic[0xc7] = StandardCharCode.Ccedilla;
ansi_generic[0xc8] = StandardCharCode.Egrave;
ansi_generic[0xc9] = StandardCharCode.Eacute;
ansi_generic[0xca] = StandardCharCode.Ecircumflex;
ansi_generic[0xcb] = StandardCharCode.Edieresis;
ansi_generic[0xcc] = StandardCharCode.Igrave;
ansi_generic[0xcd] = StandardCharCode.Iacute;
ansi_generic[0xce] = StandardCharCode.Icircumflex;
ansi_generic[0xcf] = StandardCharCode.Idieresis;
ansi_generic[0xd0] = StandardCharCode.Eth;
ansi_generic[0xd1] = StandardCharCode.Ntilde;
ansi_generic[0xd2] = StandardCharCode.Ograve;
ansi_generic[0xd3] = StandardCharCode.Oacute;
ansi_generic[0xd4] = StandardCharCode.Ocircumflex;
ansi_generic[0xd5] = StandardCharCode.Otilde;
ansi_generic[0xd6] = StandardCharCode.Odieresis;
ansi_generic[0xd7] = StandardCharCode.multiply;
ansi_generic[0xd8] = StandardCharCode.Oslash;
ansi_generic[0xd9] = StandardCharCode.Ugrave;
ansi_generic[0xda] = StandardCharCode.Uacute;
ansi_generic[0xdb] = StandardCharCode.Ucircumflex;
ansi_generic[0xdc] = StandardCharCode.Udieresis;
ansi_generic[0xdd] = StandardCharCode.Yacute;
ansi_generic[0xde] = StandardCharCode.Thorn;
ansi_generic[0xdf] = StandardCharCode.germandbls;
ansi_generic[0xe0] = StandardCharCode.agrave;
ansi_generic[0xe1] = StandardCharCode.aacute;
ansi_generic[0xe2] = StandardCharCode.acircumflex;
ansi_generic[0xe3] = StandardCharCode.atilde;
ansi_generic[0xe4] = StandardCharCode.adieresis;
ansi_generic[0xe5] = StandardCharCode.aring;
ansi_generic[0xe6] = StandardCharCode.ae;
ansi_generic[0xe7] = StandardCharCode.ccedilla;
ansi_generic[0xe8] = StandardCharCode.egrave;
ansi_generic[0xe9] = StandardCharCode.eacute;
ansi_generic[0xea] = StandardCharCode.ecircumflex;
ansi_generic[0xeb] = StandardCharCode.edieresis;
ansi_generic[0xec] = StandardCharCode.igrave;
ansi_generic[0xed] = StandardCharCode.iacute;
ansi_generic[0xee] = StandardCharCode.icircumflex;
ansi_generic[0xef] = StandardCharCode.idieresis;
ansi_generic[0xf0] = StandardCharCode.eth;
ansi_generic[0xf1] = StandardCharCode.ntilde;
ansi_generic[0xf2] = StandardCharCode.ograve;
ansi_generic[0xf3] = StandardCharCode.oacute;
ansi_generic[0xf4] = StandardCharCode.ocircumflex;
ansi_generic[0xf5] = StandardCharCode.otilde;
ansi_generic[0xf6] = StandardCharCode.odieresis;
ansi_generic[0xf7] = StandardCharCode.divide;
ansi_generic[0xf8] = StandardCharCode.oslash;
ansi_generic[0xf9] = StandardCharCode.ugrave;
ansi_generic[0xfa] = StandardCharCode.uacute;
ansi_generic[0xfb] = StandardCharCode.ucircumflex;
ansi_generic[0xfc] = StandardCharCode.udieresis;
ansi_generic[0xfd] = StandardCharCode.yacute;
ansi_generic[0xfe] = StandardCharCode.thorn;
ansi_generic[0xff] = StandardCharCode.ydieresis;
return ansi_generic;
}
}
public static Charcode AnsiSymbol {
get {
Charcode code = new Charcode(256);
code[0x06] = StandardCharCode.formula;
code[0x1e] = StandardCharCode.nobrkhyphen;
code[0x1f] = StandardCharCode.opthyphen;
code[' '] = StandardCharCode.space;
code['!'] = StandardCharCode.exclam;
code['"'] = StandardCharCode.universal;
code['#'] = StandardCharCode.mathnumbersign;
code['$'] = StandardCharCode.existential;
code['%'] = StandardCharCode.percent;
code['&'] = StandardCharCode.ampersand;
code['\\'] = StandardCharCode.suchthat;
code['('] = StandardCharCode.parenleft;
code[')'] = StandardCharCode.parenright;
code['*'] = StandardCharCode.mathasterisk;
code['+'] = StandardCharCode.mathplus;
code[','] = StandardCharCode.comma;
code['-'] = StandardCharCode.mathminus;
code['.'] = StandardCharCode.period;
code['/'] = StandardCharCode.slash;
code['0'] = StandardCharCode.zero;
code['1'] = StandardCharCode.one;
code['2'] = StandardCharCode.two;
code['3'] = StandardCharCode.three;
code['4'] = StandardCharCode.four;
code['5'] = StandardCharCode.five;
code['6'] = StandardCharCode.six;
code['7'] = StandardCharCode.seven;
code['8'] = StandardCharCode.eight;
code['9'] = StandardCharCode.nine;
code[':'] = StandardCharCode.colon;
code[';'] = StandardCharCode.semicolon;
code['<'] = StandardCharCode.less;
code['='] = StandardCharCode.mathequal;
code['>'] = StandardCharCode.greater;
code['?'] = StandardCharCode.question;
code['@'] = StandardCharCode.congruent;
code['A'] = StandardCharCode.Alpha;
code['B'] = StandardCharCode.Beta;
code['C'] = StandardCharCode.Chi;
code['D'] = StandardCharCode.Delta;
code['E'] = StandardCharCode.Epsilon;
code['F'] = StandardCharCode.Phi;
code['G'] = StandardCharCode.Gamma;
code['H'] = StandardCharCode.Eta;
code['I'] = StandardCharCode.Iota;
code['K'] = StandardCharCode.Kappa;
code['L'] = StandardCharCode.Lambda;
code['M'] = StandardCharCode.Mu;
code['N'] = StandardCharCode.Nu;
code['O'] = StandardCharCode.Omicron;
code['P'] = StandardCharCode.Pi;
code['Q'] = StandardCharCode.Theta;
code['R'] = StandardCharCode.Rho;
code['S'] = StandardCharCode.Sigma;
code['T'] = StandardCharCode.Tau;
code['U'] = StandardCharCode.Upsilon;
code['V'] = StandardCharCode.varsigma;
code['W'] = StandardCharCode.Omega;
code['X'] = StandardCharCode.Xi;
code['Y'] = StandardCharCode.Psi;
code['Z'] = StandardCharCode.Zeta;
code['['] = StandardCharCode.bracketleft;
code['\\'] = StandardCharCode.backslash;
code[']'] = StandardCharCode.bracketright;
code['^'] = StandardCharCode.asciicircum;
code['_'] = StandardCharCode.underscore;
code['`'] = StandardCharCode.quoteleft;
code['a'] = StandardCharCode.alpha;
code['b'] = StandardCharCode.beta;
code['c'] = StandardCharCode.chi;
code['d'] = StandardCharCode.delta;
code['e'] = StandardCharCode.epsilon;
code['f'] = StandardCharCode.phi;
code['g'] = StandardCharCode.gamma;
code['h'] = StandardCharCode.eta;
code['i'] = StandardCharCode.iota;
code['k'] = StandardCharCode.kappa;
code['l'] = StandardCharCode.lambda;
code['m'] = StandardCharCode.mu;
code['n'] = StandardCharCode.nu;
code['o'] = StandardCharCode.omicron;
code['p'] = StandardCharCode.pi;
code['q'] = StandardCharCode.theta;
code['r'] = StandardCharCode.rho;
code['s'] = StandardCharCode.sigma;
code['t'] = StandardCharCode.tau;
code['u'] = StandardCharCode.upsilon;
code['w'] = StandardCharCode.omega;
code['x'] = StandardCharCode.xi;
code['y'] = StandardCharCode.psi;
code['z'] = StandardCharCode.zeta;
code['{'] = StandardCharCode.braceleft;
code['|'] = StandardCharCode.bar;
code['}'] = StandardCharCode.braceright;
code['~'] = StandardCharCode.mathtilde;
return code;
}
}
#endregion // Public Static Methods
}
}
@@ -0,0 +1,157 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok ([email protected])
//
//
using System;
// COMPLETE
namespace System.Windows.Forms.RTF {
#if RTF_LIB
public
#else
internal
#endif
class Charset {
#region Local Variables
private CharsetType id;
private CharsetFlags flags;
private Charcode code;
private string file;
#endregion // Local Variables
#region Public Constructors
public Charset() {
flags = CharsetFlags.Read | CharsetFlags.Switch;
id = CharsetType.General;
file = string.Empty;
this.ReadMap();
}
#endregion // Public Constructors
#region Public Instance Properties
public Charcode Code {
get {
return code;
}
set {
code = value;
}
}
public CharsetFlags Flags {
get {
return flags;
}
set {
flags = value;
}
}
public CharsetType ID {
get {
return id;
}
set {
switch(value) {
case CharsetType.Symbol: {
id = CharsetType.Symbol;
return;
}
default:
case CharsetType.General: {
id = CharsetType.General;
return;
}
}
}
}
public string File {
get {
return file;
}
set {
if (file != value) {
file = value;
}
}
}
public StandardCharCode this[int c] {
get {
return code[c];
}
}
#endregion // Public Instance Properties
#region Public Instance Methods
public bool ReadMap() {
switch (id) {
case CharsetType.General: {
if (file == string.Empty) {
code = Charcode.AnsiGeneric;
return true;
}
// FIXME - implement reading charmap from file...
return true;
}
case CharsetType.Symbol: {
if (file == string.Empty) {
code = Charcode.AnsiSymbol;
return true;
}
// FIXME - implement reading charmap from file...
return true;
}
default: {
return false;
}
}
}
public char StdCharCode(string name) {
// FIXME - finish this
return ' ';
}
public string StdCharName(char code) {
// FIXME - finish this
return String.Empty;
}
#endregion // Public Instance Methods
}
}
@@ -0,0 +1,41 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok ([email protected])
//
//
// COMPLETE
namespace System.Windows.Forms.RTF {
[Flags]
#if RTF_LIB
public
#else
internal
#endif
enum CharsetFlags {
None = 0x00,
Read = 0x01,
Switch = 0x02
}
}
@@ -1,79 +0,0 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2020 Karl Scowen
//
// Authors:
// Karl Scowen <[email protected]>
//
//
namespace System.Windows.Forms.RTF {
internal static class CharsetToCodepage {
public static int Translate(CharsetType charset)
{
switch (charset) {
case CharsetType.General:
case CharsetType.Arabic_Traditional:
case CharsetType.Arabic_user:
case CharsetType.Hebrew_user:
case CharsetType.Mac: // Technically wrong, because "mac" should actually be quite a few with their own code pages...
default:
return System.Text.Encoding.Default.CodePage;
case CharsetType.ANSI:
return 1252;
case CharsetType.Symbol:
return 42;
case CharsetType.Shift_Jis:
return 932;
case CharsetType.Hangul:
return 949;
case CharsetType.Johab:
return 1361;
case CharsetType.GB2312:
return 936;
case CharsetType.Big5:
return 950;
case CharsetType.Greek:
return 1253;
case CharsetType.Turkish:
return 1254;
case CharsetType.Vietnamese:
return 1258;
case CharsetType.Hebrew:
return 1255;
case CharsetType.Arabic:
return 1256;
case CharsetType.Baltic:
return 1257;
case CharsetType.Russian:
return 1251;
case CharsetType.Thai:
return 874;
case CharsetType.Eastern_European:
return 1250;
case CharsetType.PC_437:
return 437;
case CharsetType.OEM:
return 850;
}
}
}
}
@@ -21,7 +21,6 @@
//
// Authors:
// Peter Bartok ([email protected])
// Karl Scowen ([email protected])
//
//
@@ -34,29 +33,8 @@ namespace System.Windows.Forms.RTF {
#else
internal
#endif
enum CharsetType : byte {
ANSI = 0,
General = 1,
Symbol = 2,
Mac = 77,
Shift_Jis = 128,
Hangul = 129,
Johab = 130,
GB2312 = 134,
Big5 = 136,
Greek = 161,
Turkish = 162,
Vietnamese = 163,
Hebrew = 177,
Arabic = 178,
Arabic_Traditional = 179,
Arabic_user = 180,
Hebrew_user = 181,
Baltic = 186,
Russian = 204,
Thai = 222,
Eastern_European = 238,
PC_437 = 254,
OEM = 255
enum CharsetType {
General = 0,
Symbol = 1,
}
}
@@ -366,12 +366,10 @@ namespace System.Windows.Forms.RTF {
new KeyStruct(Major.StyleAttr, Minor.Next, "snext"),
new KeyStruct(Major.PictAttr, Minor.MacQD, "macpict"),
new KeyStruct(Major.PictAttr, Minor.PMMetafile, "pmmetafile"),
new KeyStruct(Major.PictAttr, Minor.EnhancedMetafile, "emfblip"),
new KeyStruct(Major.PictAttr, Minor.WinMetafile, "wmetafile"),
new KeyStruct(Major.PictAttr, Minor.DevIndBitmap, "dibitmap"),
new KeyStruct(Major.PictAttr, Minor.WinBitmap, "wbitmap"),
new KeyStruct(Major.PictAttr, Minor.PngBlip, "pngblip"),
new KeyStruct(Major.PictAttr, Minor.JpegBlip, "jpgblip"),
new KeyStruct(Major.PictAttr, Minor.PixelBits, "wbmbitspixel"),
new KeyStruct(Major.PictAttr, Minor.BitmapPlanes, "wbmplanes"),
new KeyStruct(Major.PictAttr, Minor.BitmapWid, "wbmwidthbytes"),
@@ -395,7 +393,6 @@ namespace System.Windows.Forms.RTF {
new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGHeight, "height"),
new KeyStruct(Major.Destination, Minor.OptDest, "*"),
new KeyStruct(Major.Destination, Minor.FontTbl, "fonttbl"),
new KeyStruct(Major.Destination, Minor.FontName, "fname"),
new KeyStruct(Major.Destination, Minor.FontAltName, "falt"),
new KeyStruct(Major.Destination, Minor.EmbeddedFont, "fonteb"),
new KeyStruct(Major.Destination, Minor.FontFile, "fontfile"),
@@ -41,7 +41,6 @@ namespace System.Windows.Forms.RTF {
// Major.Destinan
FontTbl,
FontName,
FontAltName,
EmbeddedFont,
FontFile,
@@ -521,12 +520,10 @@ namespace System.Windows.Forms.RTF {
// Major.PictAttr
MacQD,
PMMetafile,
EnhancedMetafile,
WinMetafile,
DevIndBitmap,
WinBitmap,
PngBlip,
JpegBlip,
PixelBits,
BitmapPlanes,
BitmapWid,
@@ -66,7 +66,7 @@ namespace System.Windows.Forms.RTF {
public float Width {
get {
float w = width;
if (w < 0) {
if (w == -1) {
if (image == null)
image = ToImage ();
w = image.Width;
@@ -79,7 +79,7 @@ namespace System.Windows.Forms.RTF {
public float Height {
get {
float h = height;
if (h < 0) {
if (h == -1) {
if (image == null)
image = ToImage ();
h = image.Height;
@@ -113,9 +113,7 @@ namespace System.Windows.Forms.RTF {
return false;
switch (image_type) {
case Minor.PngBlip:
case Minor.JpegBlip:
case Minor.WinMetafile:
case Minor.EnhancedMetafile:
break;
default:
return false;
@@ -128,7 +126,15 @@ namespace System.Windows.Forms.RTF {
{
if (image == null)
image = ToImage ();
dc.DrawImage (image, x, y, Width, Height);
float height = this.height;
float width = this.width;
if (height == -1)
height = image.Height;
if (width == -1)
width = image.Width;
dc.DrawImage (image, x, y, width, height);
}
public Image ToImage ()
@@ -21,7 +21,6 @@
//
// Authors:
// Peter Bartok ([email protected])
// Karl Scowen <[email protected]>
//
// COMPLETE
@@ -61,6 +60,10 @@ namespace System.Windows.Forms.RTF {
private char prev_char;
private bool bump_line;
private Font font_list;
private Charset cur_charset;
private Stack charset_stack;
private Style styles;
@@ -98,7 +101,10 @@ namespace System.Windows.Forms.RTF {
line_pos = 0;
prev_char = unchecked((char)-1);
bump_line = false;
charset_stack = new Stack();
font_list = null;
charset_stack = null;
cur_charset = new Charset();
destination_callbacks = new DestinationCallback();
class_callbacks = new ClassCallback();
@@ -363,52 +369,49 @@ SkipCRLF:
GetToken2();
if (this.rtf_class == TokenClass.Text) {
if (encoding == null)
this.minor = (Minor)this.cur_charset[(int)this.major];
if (encoding == null) {
encoding = Encoding.GetEncoding (encoding_code_page);
}
encoded_text = new String (encoding.GetChars (new byte [] { (byte) this.major }));
} else if (CheckCMM (TokenClass.Control, Major.Unicode, Minor.UnicodeAnsiCodepage)) {
}
if (this.cur_charset.Flags == CharsetFlags.None) {
return this.rtf_class;
}
if (CheckCMM (TokenClass.Control, Major.Unicode, Minor.UnicodeAnsiCodepage)) {
encoding_code_page = param;
// fallback to the default one in case we have an invalid value
if (encoding_code_page < 0 || encoding_code_page > 65535)
encoding_code_page = DefaultEncodingCodePage;
}
encoding = null;
} else if (CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
if (((this.cur_charset.Flags & CharsetFlags.Read) != 0) && CheckCM(TokenClass.Control, Major.CharSet)) {
this.cur_charset.ReadMap();
} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
Font fp;
fp = Font.GetFont(this.fonts, this.param);
fp = Font.GetFont(this.font_list, this.param);
if (fp != null) {
if (fp.Codepage != 0) {
if (fp.Codepage != encoding_code_page) {
encoding_code_page = fp.Codepage;
encoding = null;
}
if (fp.Name.StartsWith("Symbol")) {
this.cur_charset.ID = CharsetType.Symbol;
} else {
var cp = CharsetToCodepage.Translate (fp.Charset);
if (cp != 0 && cp != encoding_code_page) {
encoding_code_page = cp;
encoding = null;
this.cur_charset.ID = CharsetType.General;
}
} else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && (this.rtf_class == TokenClass.Group)) {
switch(this.major) {
case Major.BeginGroup: {
this.charset_stack.Push(this.cur_charset);
break;
}
}
}
} else if (this.rtf_class == TokenClass.Group) {
switch(this.major) {
case Major.BeginGroup: {
charset_stack.Push(encoding_code_page);
break;
}
case Major.EndGroup: {
if (charset_stack.Count > 0) {
encoding_code_page = (int)this.charset_stack.Pop();
} else {
encoding_code_page = DefaultEncodingCodePage;
case Major.EndGroup: {
this.cur_charset = (Charset)this.charset_stack.Pop();
break;
}
if (encoding != null && encoding.CodePage != encoding_code_page)
encoding = null;
break;
}
}
}
@@ -674,10 +677,7 @@ SkipCRLF:
font = new Font(rtf);
int depth = 0;
string untaggedName = null;
while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && depth >= 0) {
while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup))) {
if (rtf.rtf_class == TokenClass.Control) {
switch(rtf.major) {
case Major.FontFamily: {
@@ -734,26 +734,6 @@ SkipCRLF:
break;
}
case Major.Destination: {
switch (rtf.minor) {
case Minor.FontName:
untaggedName = ReadFontName (rtf);
break;
case Minor.FontAltName:
font.AltName = ReadFontName (rtf);
break;
default: {
#if RTF_DEBUG
Console.WriteLine ("Got unhandled Control.Destination.Minor: " + rtf.minor);
#endif
break;
}
}
break;
}
default: {
#if RTF_DEBUG
Console.WriteLine("ReadFontTbl: Unknown Control token " + rtf.major);
@@ -762,12 +742,22 @@ SkipCRLF:
}
}
} else if (rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
depth++;
} else if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
depth--;
} else if (rtf.rtf_class == TokenClass.Text)
{
font.Name = ReadFontName (rtf);
rtf.SkipGroup();
} else if (rtf.rtf_class == TokenClass.Text) {
StringBuilder sb;
sb = new StringBuilder();
while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) && (!rtf.CheckCM(TokenClass.Group, Major.BeginGroup))) {
sb.Append((char)rtf.major);
rtf.GetToken();
}
if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
rtf.UngetToken();
}
font.Name = sb.ToString();
continue;
#if RTF_DEBUG
} else {
@@ -778,9 +768,6 @@ SkipCRLF:
rtf.GetToken();
}
if (untaggedName != null)
font.Name = untaggedName;
if (old == 0) {
rtf.GetToken();
@@ -801,26 +788,6 @@ SkipCRLF:
rtf.RouteToken();
}
private static String ReadFontName(RTF rtf)
{
StringBuilder sb = new StringBuilder ();
while (rtf.rtf_class != TokenClass.EOF && rtf.rtf_class != TokenClass.Text)
rtf.GetToken ();
while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM (TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) &&
(!rtf.CheckCM (TokenClass.Group, Major.BeginGroup))) {
sb.Append ((char)rtf.major);
rtf.GetToken ();
}
if (rtf.CheckCM (TokenClass.Group, Major.EndGroup)) {
rtf.UngetToken();
}
return sb.ToString ();
}
private void ReadColorTbl(RTF rtf) {
Color color;
int num;
@@ -976,25 +943,20 @@ SkipCRLF:
private void ReadPictGroup(RTF rtf)
{
bool read_image_data = false;
int groupDepth = 0;
Picture picture = new Picture ();
while (true) {
rtf.GetToken ();
if (rtf.CheckCM (TokenClass.Group, Major.BeginGroup))
groupDepth++;
if (rtf.CheckCM (TokenClass.Group, Major.EndGroup))
groupDepth--;
if (groupDepth < 0)
break;
switch (minor) {
case Minor.PngBlip:
case Minor.JpegBlip:
picture.ImageType = minor;
read_image_data = true;
break;
case Minor.WinMetafile:
case Minor.EnhancedMetafile:
picture.ImageType = minor;
read_image_data = true;
continue;
@@ -1085,33 +1047,10 @@ SkipCRLF:
}
}
private void ReadObjGroup (RTF rtf)
{
int level;
level = 1;
while (GetToken () != TokenClass.EOF && this.minor != Minor.ObjResult) {
if (rtf_class == TokenClass.Group) {
if (this.major == Major.BeginGroup) {
level++;
} else if (this.major == Major.EndGroup) {
level--;
if (level < 1) {
break;
}
}
}
}
if (level >= 1) {
GetToken ();
if (rtf_class == TokenClass.Group)
GetToken ();
rtf.RouteToken ();
}
private void ReadObjGroup(RTF rtf) {
rtf.SkipGroup();
rtf.RouteToken();
}
#endregion // Default Delegates
}
}
}
@@ -0,0 +1,392 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok ([email protected])
//
//
// COMPLETE
namespace System.Windows.Forms.RTF {
#if RTF_LIB
public
#else
internal
#endif
enum StandardCharCode {
nothing = 0,
space = 1,
exclam = 2,
quotedbl = 3,
numbersign = 4,
dollar = 5,
percent = 6,
ampersand = 7,
quoteright = 8,
parenleft = 9,
parenright = 10,
asterisk = 11,
plus = 12,
comma = 13,
hyphen = 14,
period = 15,
slash = 16,
zero = 17,
one = 18,
two = 19,
three = 20,
four = 21,
five = 22,
six = 23,
seven = 24,
eight = 25,
nine = 26,
colon = 27,
semicolon = 28,
less = 29,
equal = 30,
greater = 31,
question = 32,
at = 33,
A = 34,
B = 35,
C = 36,
D = 37,
E = 38,
F = 39,
G = 40,
H = 41,
I = 42,
J = 43,
K = 44,
L = 45,
M = 46,
N = 47,
O = 48,
P = 49,
Q = 50,
R = 51,
S = 52,
T = 53,
U = 54,
V = 55,
W = 56,
X = 57,
Y = 58,
Z = 59,
bracketleft = 60,
backslash = 61,
bracketright = 62,
asciicircum = 63,
underscore = 64,
quoteleft = 65,
a = 66,
b = 67,
c = 68,
d = 69,
e = 70,
f = 71,
g = 72,
h = 73,
i = 74,
j = 75,
k = 76,
l = 77,
m = 78,
n = 79,
o = 80,
p = 81,
q = 82,
r = 83,
s = 84,
t = 85,
u = 86,
v = 87,
w = 88,
x = 89,
y = 90,
z = 91,
braceleft = 92,
bar = 93,
braceright = 94,
asciitilde = 95,
exclamdown = 96,
cent = 97,
sterling = 98,
fraction = 99,
yen = 100,
florin = 101,
section = 102,
currency = 103,
quotedblleft = 104,
guillemotleft = 105,
guilsinglleft = 106,
guilsinglright = 107,
fi = 108,
fl = 109,
endash = 110,
dagger = 111,
daggerdbl = 112,
periodcentered = 113,
paragraph = 114,
bullet = 115,
quotesinglbase = 116,
quotedblbase = 117,
quotedblright = 118,
guillemotright = 119,
ellipsis = 120,
perthousand = 121,
questiondown = 122,
grave = 123,
acute = 124,
circumflex = 125,
tilde = 126,
macron = 127,
breve = 128,
dotaccent = 129,
dieresis = 130,
ring = 131,
cedilla = 132,
hungarumlaut = 133,
ogonek = 134,
caron = 135,
emdash = 136,
AE = 137,
ordfeminine = 138,
Lslash = 139,
Oslash = 140,
OE = 141,
ordmasculine = 142,
ae = 143,
dotlessi = 144,
lslash = 145,
oslash = 146,
oe = 147,
germandbls = 148,
Aacute = 149,
Acircumflex = 150,
Adieresis = 151,
Agrave = 152,
Aring = 153,
Atilde = 154,
Ccedilla = 155,
Eacute = 156,
Ecircumflex = 157,
Edieresis = 158,
Egrave = 159,
Eth = 160,
Iacute = 161,
Icircumflex = 162,
Idieresis = 163,
Igrave = 164,
Ntilde = 165,
Oacute = 166,
Ocircumflex = 167,
Odieresis = 168,
Ograve = 169,
Otilde = 170,
Scaron = 171,
Thorn = 172,
Uacute = 173,
Ucircumflex = 174,
Udieresis = 175,
Ugrave = 176,
Yacute = 177,
Ydieresis = 178,
aacute = 179,
acircumflex = 180,
adieresis = 181,
agrave = 182,
aring = 183,
atilde = 184,
brokenbar = 185,
ccedilla = 186,
copyright = 187,
degree = 188,
divide = 189,
eacute = 190,
ecircumflex = 191,
edieresis = 192,
egrave = 193,
eth = 194,
iacute = 195,
icircumflex = 196,
idieresis = 197,
igrave = 198,
logicalnot = 199,
minus = 200,
multiply = 201,
ntilde = 202,
oacute = 203,
ocircumflex = 204,
odieresis = 205,
ograve = 206,
onehalf = 207,
onequarter = 208,
onesuperior = 209,
otilde = 210,
plusminus = 211,
registered = 212,
thorn = 213,
threequarters = 214,
threesuperior = 215,
trademark = 216,
twosuperior = 217,
uacute = 218,
ucircumflex = 219,
udieresis = 220,
ugrave = 221,
yacute = 222,
ydieresis = 223,
Alpha = 224,
Beta = 225,
Chi = 226,
Delta = 227,
Epsilon = 228,
Phi = 229,
Gamma = 230,
Eta = 231,
Iota = 232,
Kappa = 233,
Lambda = 234,
Mu = 235,
Nu = 236,
Omicron = 237,
Pi = 238,
Theta = 239,
Rho = 240,
Sigma = 241,
Tau = 242,
Upsilon = 243,
varUpsilon = 244,
Omega = 245,
Xi = 246,
Psi = 247,
Zeta = 248,
alpha = 249,
beta = 250,
chi = 251,
delta = 252,
epsilon = 253,
phi = 254,
varphi = 255,
gamma = 256,
eta = 257,
iota = 258,
kappa = 259,
lambda = 260,
mu = 261,
nu = 262,
omicron = 263,
pi = 264,
varpi = 265,
theta = 266,
vartheta = 267,
rho = 268,
sigma = 269,
varsigma = 270,
tau = 271,
upsilon = 272,
omega = 273,
xi = 274,
psi = 275,
zeta = 276,
nobrkspace = 277,
nobrkhyphen = 278,
lessequal = 279,
greaterequal = 280,
infinity = 281,
integral = 282,
notequal = 283,
radical = 284,
radicalex = 285,
approxequal = 286,
apple = 287,
partialdiff = 288,
opthyphen = 289,
formula = 290,
lozenge = 291,
universal = 292,
existential = 293,
suchthat = 294,
congruent = 295,
therefore = 296,
perpendicular = 297,
minute = 298,
club = 299,
diamond = 300,
heart = 301,
spade = 302,
arrowboth = 303,
arrowleft = 304,
arrowup = 305,
arrowright = 306,
arrowdown = 307,
second = 308,
proportional = 309,
equivalence = 310,
arrowvertex = 311,
arrowhorizex = 312,
carriagereturn = 313,
aleph = 314,
Ifraktur = 315,
Rfraktur = 316,
weierstrass = 317,
circlemultiply = 318,
circleplus = 319,
emptyset = 320,
intersection = 321,
union = 322,
propersuperset = 323,
reflexsuperset = 324,
notsubset = 325,
propersubset = 326,
reflexsubset = 327,
element = 328,
notelement = 329,
angle = 330,
gradient = 331,
product = 332,
logicaland = 333,
logicalor = 334,
arrowdblboth = 335,
arrowdblleft = 336,
arrowdblup = 337,
arrowdblright = 338,
arrowdbldown = 339,
angleleft = 340,
registersans = 341,
copyrightsans = 342,
trademarksans = 343,
angleright = 344,
mathplus = 345,
mathminus = 346,
mathasterisk = 347,
mathnumbersign = 348,
dotmath = 349,
mathequal = 350,
mathtilde = 351,
MaxChar = 352
}
}
@@ -0,0 +1,411 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok ([email protected])
//
//
// COMPLETE
namespace System.Windows.Forms.RTF {
#if RTF_LIB
public
#else
internal
#endif
class StandardCharName {
public static string[] Names = {
"nothing",
"space",
"exclam",
"quotedbl",
"numbersign",
"dollar",
"percent",
"ampersand",
"quoteright",
"parenleft",
"parenright",
"asterisk",
"plus",
"comma",
"hyphen",
"period",
"slash",
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"colon",
"semicolon",
"less",
"equal",
"greater",
"question",
"at",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"bracketleft",
"backslash",
"bracketright",
"asciicircum",
"underscore",
"quoteleft",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
"braceleft",
"bar",
"braceright",
"asciitilde",
"exclamdown",
"cent",
"sterling",
"fraction",
"yen",
"florin",
"section",
"currency",
"quotedblleft",
"guillemotleft",
"guilsinglleft",
"guilsinglright",
"fi",
"fl",
"endash",
"dagger",
"daggerdbl",
"periodcentered",
"paragraph",
"bullet",
"quotesinglbase",
"quotedblbase",
"quotedblright",
"guillemotright",
"ellipsis",
"perthousand",
"questiondown",
"grave",
"acute",
"circumflex",
"tilde",
"macron",
"breve",
"dotaccent",
"dieresis",
"ring",
"cedilla",
"hungarumlaut",
"ogonek",
"caron",
"emdash",
"AE",
"ordfeminine",
"Lslash",
"Oslash",
"OE",
"ordmasculine",
"ae",
"dotlessi",
"lslash",
"oslash",
"oe",
"germandbls",
"Aacute",
"Acircumflex",
"Adieresis",
"Agrave",
"Aring",
"Atilde",
"Ccedilla",
"Eacute",
"Ecircumflex",
"Edieresis",
"Egrave",
"Eth",
"Iacute",
"Icircumflex",
"Idieresis",
"Igrave",
"Ntilde",
"Oacute",
"Ocircumflex",
"Odieresis",
"Ograve",
"Otilde",
"Scaron",
"Thorn",
"Uacute",
"Ucircumflex",
"Udieresis",
"Ugrave",
"Yacute",
"Ydieresis",
"aacute",
"acircumflex",
"adieresis",
"agrave",
"aring",
"atilde",
"brokenbar",
"ccedilla",
"copyright",
"degree",
"divide",
"eacute",
"ecircumflex",
"edieresis",
"egrave",
"eth",
"iacute",
"icircumflex",
"idieresis",
"igrave",
"logicalnot",
"minus",
"multiply",
"ntilde",
"oacute",
"ocircumflex",
"odieresis",
"ograve",
"onehalf",
"onequarter",
"onesuperior",
"otilde",
"plusminus",
"registered",
"thorn",
"threequarters",
"threesuperior",
"trademark",
"twosuperior",
"uacute",
"ucircumflex",
"udieresis",
"ugrave",
"yacute",
"ydieresis",
"Alpha",
"Beta",
"Chi",
"Delta",
"Epsilon",
"Phi",
"Gamma",
"Eta",
"Iota",
"Kappa",
"Lambda",
"Mu",
"Nu",
"Omicron",
"Pi",
"Theta",
"Rho",
"Sigma",
"Tau",
"Upsilon",
"varUpsilon",
"Omega",
"Xi",
"Psi",
"Zeta",
"alpha",
"beta",
"chi",
"delta",
"epsilon",
"phi",
"varphi",
"gamma",
"eta",
"iota",
"kappa",
"lambda",
"mu",
"nu",
"omicron",
"pi",
"varpi",
"theta",
"vartheta",
"rho",
"sigma",
"varsigma",
"tau",
"upsilon",
"omega",
"xi",
"psi",
"zeta",
"nobrkspace",
"nobrkhyphen",
"lessequal",
"greaterequal",
"infinity",
"integral",
"notequal",
"radical",
"radicalex",
"approxequal",
"apple",
"partialdiff",
"opthyphen",
"formula",
"lozenge",
"universal",
"existential",
"suchthat",
"congruent",
"therefore",
"perpendicular",
"minute",
"club",
"diamond",
"heart",
"spade",
"arrowboth",
"arrowleft",
"arrowup",
"arrowright",
"arrowdown",
"second",
"proportional",
"equivalence",
"arrowvertex",
"arrowhorizex",
"carriagereturn",
"aleph",
"Ifraktur",
"Rfraktur",
"weierstrass",
"circlemultiply",
"circleplus",
"emptyset",
"intersection",
"union",
"propersuperset",
"reflexsuperset",
"notsubset",
"propersubset",
"reflexsubset",
"element",
"notelement",
"angle",
"gradient",
"product",
"logicaland",
"logicalor",
"arrowdblboth",
"arrowdblleft",
"arrowdblup",
"arrowdblright",
"arrowdbldown",
"angleleft",
"registersans",
"copyrightsans",
"trademarksans",
"angleright",
"mathplus",
"mathminus",
"mathasterisk",
"mathnumbersign",
"dotmath",
"mathequal",
"mathtilde"
};
/// <summary>Lookup name by ID</summary>
public static string Name(int index) {
if ((index < 0) || (index >= Names.Length)) {
return string.Empty;
}
return Names[index];
}
/// <summary>Lookup ID by name (e.g. mathtilde)</summary>
public static int ID(string name) {
for (int i=0; i < Names.Length; i++) {
if (name.Equals(Names[i])) {
return i;
}
}
return 0;
}
}
}
@@ -0,0 +1,440 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok ([email protected])
//
//
// This map is for convencience only, any app can create/use it's own
// StdCharCode -> <text> table
using System.Collections;
namespace System.Windows.Forms.RTF {
#if RTF_LIB
public
#else
internal
#endif
class TextMap {
#region Local Variables
private string[] table;
#endregion // Local Variables
#region Public Constructors
public TextMap() {
table = new string[(int)StandardCharCode.MaxChar];
for (int i = 0; i < (int)StandardCharCode.MaxChar; i++) {
table[i] = string.Empty;
}
}
#endregion // Public Constructors
#region Public Instance Properties
internal string this[StandardCharCode c] { // FIXME - this should be public, if the whole namespace was public (ie standalone RTF parser)
get {
return table[(int)c];
}
set {
table[(int)c] = value;
}
}
public string[] Table {
get {
return table;
}
}
#endregion // Public Instance Properties
#region Public Static Methods
public static void SetupStandardTable(string[] table)
{
/*
table[(int)StandardCharCode.space] = " ";
table[(int)StandardCharCode.exclam] = "!";
table[(int)StandardCharCode.quotedbl] = "\"";
table[(int)StandardCharCode.numbersign] = "#";
table[(int)StandardCharCode.dollar] = "$";
table[(int)StandardCharCode.percent] = "%";
table[(int)StandardCharCode.ampersand] = "&";
table[(int)StandardCharCode.quoteright] = "'";
table[(int)StandardCharCode.parenleft] = "(";
table[(int)StandardCharCode.parenright] = ")";
table[(int)StandardCharCode.asterisk] = "*";
table[(int)StandardCharCode.plus] = "+";
table[(int)StandardCharCode.comma] = ",";
table[(int)StandardCharCode.hyphen] = "-";
table[(int)StandardCharCode.period] = ".";
table[(int)StandardCharCode.slash] = "/";
table[(int)StandardCharCode.zero] = "0";
table[(int)StandardCharCode.one] = "1";
table[(int)StandardCharCode.two] = "2";
table[(int)StandardCharCode.three] = "3";
table[(int)StandardCharCode.four] = "4";
table[(int)StandardCharCode.five] = "5";
table[(int)StandardCharCode.six] = "6";
table[(int)StandardCharCode.seven] = "7";
table[(int)StandardCharCode.eight] = "8";
table[(int)StandardCharCode.nine] = "9";
table[(int)StandardCharCode.colon] = ":";
table[(int)StandardCharCode.semicolon] = ";";
table[(int)StandardCharCode.less] = "<";
table[(int)StandardCharCode.equal] = "=";
table[(int)StandardCharCode.greater] = ">";
table[(int)StandardCharCode.question] = "?";
table[(int)StandardCharCode.at] = "@";
table[(int)StandardCharCode.A] = "A";
table[(int)StandardCharCode.B] = "B";
table[(int)StandardCharCode.C] = "C";
table[(int)StandardCharCode.D] = "D";
table[(int)StandardCharCode.E] = "E";
table[(int)StandardCharCode.F] = "F";
table[(int)StandardCharCode.G] = "G";
table[(int)StandardCharCode.H] = "H";
table[(int)StandardCharCode.I] = "I";
table[(int)StandardCharCode.J] = "J";
table[(int)StandardCharCode.K] = "K";
table[(int)StandardCharCode.L] = "L";
table[(int)StandardCharCode.M] = "M";
table[(int)StandardCharCode.N] = "N";
table[(int)StandardCharCode.O] = "O";
table[(int)StandardCharCode.P] = "P";
table[(int)StandardCharCode.Q] = "Q";
table[(int)StandardCharCode.R] = "R";
table[(int)StandardCharCode.S] = "S";
table[(int)StandardCharCode.T] = "T";
table[(int)StandardCharCode.U] = "U";
table[(int)StandardCharCode.V] = "V";
table[(int)StandardCharCode.W] = "W";
table[(int)StandardCharCode.X] = "X";
table[(int)StandardCharCode.Y] = "Y";
table[(int)StandardCharCode.Z] = "Z";
table[(int)StandardCharCode.bracketleft] = "[";
table[(int)StandardCharCode.backslash] = "\\";
table[(int)StandardCharCode.bracketright] = "]";
table[(int)StandardCharCode.asciicircum] = "^";
table[(int)StandardCharCode.underscore] = "_";
table[(int)StandardCharCode.quoteleft] = "`";
table[(int)StandardCharCode.a] = "a";
table[(int)StandardCharCode.b] = "b";
table[(int)StandardCharCode.c] = "c";
table[(int)StandardCharCode.d] = "d";
table[(int)StandardCharCode.e] = "e";
table[(int)StandardCharCode.f] = "f";
table[(int)StandardCharCode.g] = "g";
table[(int)StandardCharCode.h] = "h";
table[(int)StandardCharCode.i] = "i";
table[(int)StandardCharCode.j] = "j";
table[(int)StandardCharCode.k] = "k";
table[(int)StandardCharCode.l] = "l";
table[(int)StandardCharCode.m] = "m";
table[(int)StandardCharCode.n] = "n";
table[(int)StandardCharCode.o] = "o";
table[(int)StandardCharCode.p] = "p";
table[(int)StandardCharCode.q] = "q";
table[(int)StandardCharCode.r] = "r";
table[(int)StandardCharCode.s] = "s";
table[(int)StandardCharCode.t] = "t";
table[(int)StandardCharCode.u] = "u";
table[(int)StandardCharCode.v] = "v";
table[(int)StandardCharCode.w] = "w";
table[(int)StandardCharCode.x] = "x";
table[(int)StandardCharCode.y] = "y";
table[(int)StandardCharCode.z] = "z";
table[(int)StandardCharCode.braceleft] = "{";
table[(int)StandardCharCode.bar] = "|";
table[(int)StandardCharCode.braceright] = "}";
table[(int)StandardCharCode.asciitilde] = "~";
table[(int)StandardCharCode.AE] = "AE";
table[(int)StandardCharCode.OE] = "OE";
table[(int)StandardCharCode.acute] = "'";
table[(int)StandardCharCode.ae] = "ae";
table[(int)StandardCharCode.angleleft] = "<";
table[(int)StandardCharCode.angleright] = ">";
table[(int)StandardCharCode.arrowboth] = "<->";
table[(int)StandardCharCode.arrowdblboth] = "<=>";
table[(int)StandardCharCode.arrowdblleft] = "<=";
table[(int)StandardCharCode.arrowdblright] = "=>";
table[(int)StandardCharCode.arrowleft] = "<-";
table[(int)StandardCharCode.arrowright] = "->";
table[(int)StandardCharCode.bullet] = "o";
table[(int)StandardCharCode.cent] = "cent";
table[(int)StandardCharCode.circumflex] = "^";
table[(int)StandardCharCode.copyright] = "(c)";
table[(int)StandardCharCode.copyrightsans] = "(c)";
table[(int)StandardCharCode.degree] = "deg.";
table[(int)StandardCharCode.divide] = "/";
table[(int)StandardCharCode.dotlessi] = "i";
table[(int)StandardCharCode.ellipsis] = "...";
table[(int)StandardCharCode.emdash] = "--";
table[(int)StandardCharCode.endash] = "-";
table[(int)StandardCharCode.fi] = "fi";
table[(int)StandardCharCode.fl] = "fl";
table[(int)StandardCharCode.fraction] = "/";
table[(int)StandardCharCode.germandbls] = "ss";
table[(int)StandardCharCode.grave] = "`";
table[(int)StandardCharCode.greaterequal] = ">=";
table[(int)StandardCharCode.guillemotleft] = "<<";
table[(int)StandardCharCode.guillemotright] = ">>";
table[(int)StandardCharCode.guilsinglleft] = "<";
table[(int)StandardCharCode.guilsinglright] = ">";
table[(int)StandardCharCode.lessequal] = "<=";
table[(int)StandardCharCode.logicalnot] = "~";
table[(int)StandardCharCode.mathasterisk] = "*";
table[(int)StandardCharCode.mathequal] = "=";
table[(int)StandardCharCode.mathminus] = "-";
table[(int)StandardCharCode.mathnumbersign] = "#";
table[(int)StandardCharCode.mathplus] = "+";
table[(int)StandardCharCode.mathtilde] = "~";
table[(int)StandardCharCode.minus] = "-";
table[(int)StandardCharCode.mu] = "u";
table[(int)StandardCharCode.multiply] = "x";
table[(int)StandardCharCode.nobrkhyphen] = "-";
table[(int)StandardCharCode.nobrkspace] = "";
table[(int)StandardCharCode.notequal] = "!=";
table[(int)StandardCharCode.oe] = "oe";
table[(int)StandardCharCode.onehalf] = "1/2";
table[(int)StandardCharCode.onequarter] = "1/4";
table[(int)StandardCharCode.periodcentered] = ".";
table[(int)StandardCharCode.plusminus] = "+/-";
table[(int)StandardCharCode.quotedblbase] = ",,";
table[(int)StandardCharCode.quotedblleft] = "\"";
table[(int)StandardCharCode.quotedblright] = "\"";
table[(int)StandardCharCode.quotesinglbase] = ",";
table[(int)StandardCharCode.registered] = "reg.";
table[(int)StandardCharCode.registersans] = "reg.";
table[(int)StandardCharCode.threequarters] = "3/4";
table[(int)StandardCharCode.tilde] = "~";
table[(int)StandardCharCode.trademark] = "(TM)";
table[(int)StandardCharCode.trademarksans] = "(TM)";
table[(int)StandardCharCode.aacute] = "\xE0";
table[(int)StandardCharCode.questiondown] = "\xBF";
table[(int)StandardCharCode.udieresis] = "\xFC";
table[(int)StandardCharCode.Udieresis] = "\xDC";
table[(int)StandardCharCode.odieresis] = "\xF6";
table[(int)StandardCharCode.Odieresis] = "\xD6";
*/
table [(int) StandardCharCode.formula] = "\x6";
table [(int) StandardCharCode.nobrkhyphen] = "\x1e";
table [(int) StandardCharCode.opthyphen] = "\x1f";
table [(int) StandardCharCode.space] = " ";
table [(int) StandardCharCode.exclam] = "!";
table [(int) StandardCharCode.quotedbl] = "\"";
table [(int) StandardCharCode.numbersign] = "#";
table [(int) StandardCharCode.dollar] = "$";
table [(int) StandardCharCode.percent] = "%";
table [(int) StandardCharCode.ampersand] = "&";
table [(int) StandardCharCode.parenleft] = "(";
table [(int) StandardCharCode.parenright] = ")";
table [(int) StandardCharCode.asterisk] = "*";
table [(int) StandardCharCode.plus] = "+";
table [(int) StandardCharCode.comma] = ",";
table [(int) StandardCharCode.hyphen] = "-";
table [(int) StandardCharCode.period] = ".";
table [(int) StandardCharCode.slash] = "/";
table [(int) StandardCharCode.zero] = "0";
table [(int) StandardCharCode.one] = "1";
table [(int) StandardCharCode.two] = "2";
table [(int) StandardCharCode.three] = "3";
table [(int) StandardCharCode.four] = "4";
table [(int) StandardCharCode.five] = "5";
table [(int) StandardCharCode.six] = "6";
table [(int) StandardCharCode.seven] = "7";
table [(int) StandardCharCode.eight] = "8";
table [(int) StandardCharCode.nine] = "9";
table [(int) StandardCharCode.colon] = ":";
table [(int) StandardCharCode.semicolon] = ";";
table [(int) StandardCharCode.less] = "<";
table [(int) StandardCharCode.equal] = "=";
table [(int) StandardCharCode.greater] = ">";
table [(int) StandardCharCode.question] = "?";
table [(int) StandardCharCode.at] = "@";
table [(int) StandardCharCode.A] = "A";
table [(int) StandardCharCode.B] = "B";
table [(int) StandardCharCode.C] = "C";
table [(int) StandardCharCode.D] = "D";
table [(int) StandardCharCode.E] = "E";
table [(int) StandardCharCode.F] = "F";
table [(int) StandardCharCode.G] = "G";
table [(int) StandardCharCode.H] = "H";
table [(int) StandardCharCode.I] = "I";
table [(int) StandardCharCode.J] = "J";
table [(int) StandardCharCode.K] = "K";
table [(int) StandardCharCode.L] = "L";
table [(int) StandardCharCode.M] = "M";
table [(int) StandardCharCode.N] = "N";
table [(int) StandardCharCode.O] = "O";
table [(int) StandardCharCode.P] = "P";
table [(int) StandardCharCode.Q] = "Q";
table [(int) StandardCharCode.R] = "R";
table [(int) StandardCharCode.S] = "S";
table [(int) StandardCharCode.T] = "T";
table [(int) StandardCharCode.U] = "U";
table [(int) StandardCharCode.V] = "V";
table [(int) StandardCharCode.W] = "W";
table [(int) StandardCharCode.X] = "X";
table [(int) StandardCharCode.Y] = "Y";
table [(int) StandardCharCode.Z] = "Z";
table [(int) StandardCharCode.bracketleft] = "[";
table [(int) StandardCharCode.backslash] = "\\";
table [(int) StandardCharCode.bracketright] = "]";
table [(int) StandardCharCode.asciicircum] = "^";
table [(int) StandardCharCode.underscore] = "_";
table [(int) StandardCharCode.quoteleft] = "`";
table [(int) StandardCharCode.a] = "a";
table [(int) StandardCharCode.b] = "b";
table [(int) StandardCharCode.c] = "c";
table [(int) StandardCharCode.d] = "d";
table [(int) StandardCharCode.e] = "e";
table [(int) StandardCharCode.f] = "f";
table [(int) StandardCharCode.g] = "g";
table [(int) StandardCharCode.h] = "h";
table [(int) StandardCharCode.i] = "i";
table [(int) StandardCharCode.j] = "j";
table [(int) StandardCharCode.k] = "k";
table [(int) StandardCharCode.l] = "l";
table [(int) StandardCharCode.m] = "m";
table [(int) StandardCharCode.n] = "n";
table [(int) StandardCharCode.o] = "o";
table [(int) StandardCharCode.p] = "p";
table [(int) StandardCharCode.q] = "q";
table [(int) StandardCharCode.r] = "r";
table [(int) StandardCharCode.s] = "s";
table [(int) StandardCharCode.t] = "t";
table [(int) StandardCharCode.u] = "u";
table [(int) StandardCharCode.v] = "v";
table [(int) StandardCharCode.w] = "w";
table [(int) StandardCharCode.x] = "x";
table [(int) StandardCharCode.y] = "y";
table [(int) StandardCharCode.z] = "z";
table [(int) StandardCharCode.braceleft] = "{";
table [(int) StandardCharCode.bar] = "|";
table [(int) StandardCharCode.braceright] = "}";
table [(int) StandardCharCode.asciitilde] = "~";
table [(int) StandardCharCode.nobrkspace] = "\xa0";
table [(int) StandardCharCode.exclamdown] = "\xa1";
table [(int) StandardCharCode.cent] = "\xa2";
table [(int) StandardCharCode.sterling] = "\xa3";
table [(int) StandardCharCode.currency] = "\xa4";
table [(int) StandardCharCode.yen] = "\xa5";
table [(int) StandardCharCode.brokenbar] = "\xa6";
table [(int) StandardCharCode.section] = "\xa7";
table [(int) StandardCharCode.dieresis] = "\xa8";
table [(int) StandardCharCode.copyright] = "\xa9";
table [(int) StandardCharCode.ordfeminine] = "\xaa";
table [(int) StandardCharCode.guillemotleft] = "\xab";
table [(int) StandardCharCode.logicalnot] = "\xac";
table [(int) StandardCharCode.opthyphen] = "\xad";
table [(int) StandardCharCode.registered] = "\xae";
table [(int) StandardCharCode.macron] = "\xaf";
table [(int) StandardCharCode.degree] = "\xb0";
table [(int) StandardCharCode.plusminus] = "\xb1";
table [(int) StandardCharCode.twosuperior] = "\xb2";
table [(int) StandardCharCode.threesuperior] = "\xb3";
table [(int) StandardCharCode.acute] = "\xb4";
table [(int) StandardCharCode.mu] = "\xb5";
table [(int) StandardCharCode.paragraph] = "\xb6";
table [(int) StandardCharCode.periodcentered] = "\xb7";
table [(int) StandardCharCode.cedilla] = "\xb8";
table [(int) StandardCharCode.onesuperior] = "\xb9";
table [(int) StandardCharCode.ordmasculine] = "\xba";
table [(int) StandardCharCode.guillemotright] = "\xbb";
table [(int) StandardCharCode.onequarter] = "\xbc";
table [(int) StandardCharCode.onehalf] = "\xbd";
table [(int) StandardCharCode.threequarters] = "\xbe";
table [(int) StandardCharCode.questiondown] = "\xbf";
table [(int) StandardCharCode.Agrave] = "\xc0";
table [(int) StandardCharCode.Aacute] = "\xc1";
table [(int) StandardCharCode.Acircumflex] = "\xc2";
table [(int) StandardCharCode.Atilde] = "\xc3";
table [(int) StandardCharCode.Adieresis] = "\xc4";
table [(int) StandardCharCode.Aring] = "\xc5";
table [(int) StandardCharCode.AE] = "\xc6";
table [(int) StandardCharCode.Ccedilla] = "\xc7";
table [(int) StandardCharCode.Egrave] = "\xc8";
table [(int) StandardCharCode.Eacute] = "\xc9";
table [(int) StandardCharCode.Ecircumflex] = "\xca";
table [(int) StandardCharCode.Edieresis] = "\xcb";
table [(int) StandardCharCode.Igrave] = "\xcc";
table [(int) StandardCharCode.Iacute] = "\xcd";
table [(int) StandardCharCode.Icircumflex] = "\xce";
table [(int) StandardCharCode.Idieresis] = "\xcf";
table [(int) StandardCharCode.Eth] = "\xd0";
table [(int) StandardCharCode.Ntilde] = "\xd1";
table [(int) StandardCharCode.Ograve] = "\xd2";
table [(int) StandardCharCode.Oacute] = "\xd3";
table [(int) StandardCharCode.Ocircumflex] = "\xd4";
table [(int) StandardCharCode.Otilde] = "\xd5";
table [(int) StandardCharCode.Odieresis] = "\xd6";
table [(int) StandardCharCode.multiply] = "\xd7";
table [(int) StandardCharCode.Oslash] = "\xd8";
table [(int) StandardCharCode.Ugrave] = "\xd9";
table [(int) StandardCharCode.Uacute] = "\xda";
table [(int) StandardCharCode.Ucircumflex] = "\xdb";
table [(int) StandardCharCode.Udieresis] = "\xdc";
table [(int) StandardCharCode.Yacute] = "\xdd";
table [(int) StandardCharCode.Thorn] = "\xde";
table [(int) StandardCharCode.germandbls] = "\xdf";
table [(int) StandardCharCode.agrave] = "\xe0";
table [(int) StandardCharCode.aacute] = "\xe1";
table [(int) StandardCharCode.acircumflex] = "\xe2";
table [(int) StandardCharCode.atilde] = "\xe3";
table [(int) StandardCharCode.adieresis] = "\xe4";
table [(int) StandardCharCode.aring] = "\xe5";
table [(int) StandardCharCode.ae] = "\xe6";
table [(int) StandardCharCode.ccedilla] = "\xe7";
table [(int) StandardCharCode.egrave] = "\xe8";
table [(int) StandardCharCode.eacute] = "\xe9";
table [(int) StandardCharCode.ecircumflex] = "\xea";
table [(int) StandardCharCode.edieresis] = "\xeb";
table [(int) StandardCharCode.igrave] = "\xec";
table [(int) StandardCharCode.iacute] = "\xed";
table [(int) StandardCharCode.icircumflex] = "\xee";
table [(int) StandardCharCode.idieresis] = "\xef";
table [(int) StandardCharCode.eth] = "\xf0";
table [(int) StandardCharCode.ntilde] = "\xf1";
table [(int) StandardCharCode.ograve] = "\xf2";
table [(int) StandardCharCode.oacute] = "\xf3";
table [(int) StandardCharCode.ocircumflex] = "\xf4";
table [(int) StandardCharCode.otilde] = "\xf5";
table [(int) StandardCharCode.odieresis] = "\xf6";
table [(int) StandardCharCode.divide] = "\xf7";
table [(int) StandardCharCode.oslash] = "\xf8";
table [(int) StandardCharCode.ugrave] = "\xf9";
table [(int) StandardCharCode.uacute] = "\xfa";
table [(int) StandardCharCode.ucircumflex] = "\xfb";
table [(int) StandardCharCode.udieresis] = "\xfc";
table [(int) StandardCharCode.yacute] = "\xfd";
table [(int) StandardCharCode.thorn] = "\xfe";
table [(int) StandardCharCode.ydieresis] = "\xff";
}
#endregion // Public Static Methods
}
}
@@ -40,8 +40,6 @@ namespace System.Windows.Forms.Theming.Default
label.DrawImage (dc, label.Image, rect, label.ImageAlign);
rect.Height = Math.Max(rect.Height, label.Font.Height);
if (label.Enabled) {
dc.DrawString (label.Text, label.Font,
ThemeEngine.Current.ResPool.GetSolidBrush (label.ForeColor),
@@ -100,7 +100,9 @@
<Compile Include="System.Windows.Forms.Layout\TableLayout.cs" />
<Compile Include="System.Windows.Forms.Layout\TableLayoutSettingsTypeConverter.cs" />
<Compile Include="System.Windows.Forms.PropertyGridInternal\PropertiesTab.cs" />
<Compile Include="System.Windows.Forms.RTF\CharsetToCodepage.cs" />
<Compile Include="System.Windows.Forms.RTF\Charcode.cs" />
<Compile Include="System.Windows.Forms.RTF\Charset.cs" />
<Compile Include="System.Windows.Forms.RTF\CharsetFlags.cs" />
<Compile Include="System.Windows.Forms.RTF\CharsetType.cs" />
<Compile Include="System.Windows.Forms.RTF\ClassDelegate.cs" />
<Compile Include="System.Windows.Forms.RTF\Color.cs" />
@@ -113,9 +115,12 @@
<Compile Include="System.Windows.Forms.RTF\Picture.cs" />
<Compile Include="System.Windows.Forms.RTF\RTF.cs" />
<Compile Include="System.Windows.Forms.RTF\RTFException.cs" />
<Compile Include="System.Windows.Forms.RTF\StandardCharCode.cs" />
<Compile Include="System.Windows.Forms.RTF\StandardCharName.cs" />
<Compile Include="System.Windows.Forms.RTF\Style.cs" />
<Compile Include="System.Windows.Forms.RTF\StyleElement.cs" />
<Compile Include="System.Windows.Forms.RTF\StyleType.cs" />
<Compile Include="System.Windows.Forms.RTF\TextMap.cs" />
<Compile Include="System.Windows.Forms.RTF\TokenClass.cs" />
<Compile Include="System.Windows.Forms.Theming\Default\ButtonPainter.cs" />
<Compile Include="System.Windows.Forms.Theming\Default\CheckBoxPainter.cs" />
@@ -782,7 +787,6 @@
<Compile Include="System.Windows.Forms\TabPage.cs" />
<Compile Include="System.Windows.Forms\TabRenderer.cs" />
<Compile Include="System.Windows.Forms\TabSizeMode.cs" />
<Compile Include="System.Windows.Forms\TabStops.cs" />
<Compile Include="System.Windows.Forms\TableLayoutCellPaintEventArgs.cs" />
<Compile Include="System.Windows.Forms\TableLayoutCellPaintEventHandler.cs" />
<Compile Include="System.Windows.Forms\TableLayoutColumnStyleCollection.cs" />
@@ -29,7 +29,9 @@ System.Windows.Forms.Design/WindowsFormsComponentEditor.cs
System.Windows.Forms.Internal/Accessor.cs
System.Windows.Forms.Internal/DebugHelper.cs
System.Windows.Forms.PropertyGridInternal/PropertiesTab.cs
System.Windows.Forms.RTF/CharsetToCodepage.cs
System.Windows.Forms.RTF/Charcode.cs
System.Windows.Forms.RTF/Charset.cs
System.Windows.Forms.RTF/CharsetFlags.cs
System.Windows.Forms.RTF/CharsetType.cs
System.Windows.Forms.RTF/ClassDelegate.cs
System.Windows.Forms.RTF/Color.cs
@@ -42,9 +44,12 @@ System.Windows.Forms.RTF/Minor.cs
System.Windows.Forms.RTF/Picture.cs
System.Windows.Forms.RTF/RTF.cs
System.Windows.Forms.RTF/RTFException.cs
System.Windows.Forms.RTF/StandardCharCode.cs
System.Windows.Forms.RTF/StandardCharName.cs
System.Windows.Forms.RTF/Style.cs
System.Windows.Forms.RTF/StyleElement.cs
System.Windows.Forms.RTF/StyleType.cs
System.Windows.Forms.RTF/TextMap.cs
System.Windows.Forms.RTF/TokenClass.cs
System.Windows.Forms.Theming/Default/LabelPainter.cs
System.Windows.Forms.Theming/Default/LinkLabelPainter.cs
@@ -652,7 +657,6 @@ System.Windows.Forms/TableLayoutRowStyleCollection.cs
System.Windows.Forms/TableLayoutSettings.cs
System.Windows.Forms/TableLayoutStyle.cs
System.Windows.Forms/TableLayoutStyleCollection.cs
System.Windows.Forms/TabStops.cs
System.Windows.Forms/TextBox.cs
System.Windows.Forms/TextBoxBase.cs
System.Windows.Forms/TextBoxRenderer.cs
@@ -92,16 +92,14 @@ namespace System.Windows.Forms {
#region Protected Methods
protected override void OnClick (EventArgs e)
{
Form p = FindForm ();
if (p != null) {
p.dialog_result_changed = false; // manages the case where the DialogResult of the form is overriden in the button click event.
base.OnClick (e);
if (dialog_result != DialogResult.None && !p.dialog_result_changed) {
if (dialog_result != DialogResult.None) {
Form p = FindForm ();
if (p != null)
p.DialogResult = dialog_result;
}
} else {
base.OnClick (e);
}
base.OnClick (e);
}
protected override void OnFontChanged (EventArgs e)
@@ -1695,7 +1695,7 @@ namespace System.Windows.Forms
}
}
void SetSelectedIndex (int value, bool supressAutoScroll, bool triggerEvents = true)
void SetSelectedIndex (int value, bool supressAutoScroll)
{
if (selected_index == value)
return;
@@ -1718,11 +1718,9 @@ namespace System.Windows.Forms
if (listbox_ctrl != null)
listbox_ctrl.HighlightedIndex = value;
if (triggerEvents) {
OnSelectedValueChanged (EventArgs.Empty);
OnSelectedIndexChanged (EventArgs.Empty);
OnSelectedItemChanged (EventArgs.Empty);
}
OnSelectedValueChanged (EventArgs.Empty);
OnSelectedIndexChanged (EventArgs.Empty);
OnSelectedItemChanged (EventArgs.Empty);
}
// If no item is currently selected, and an item is found matching the text
@@ -2136,7 +2134,9 @@ namespace System.Windows.Forms
throw new ArgumentOutOfRangeException ("index");
if (index < owner.SelectedIndex)
owner.SetSelectedIndex (owner.SelectedIndex - 1, false, false);
--owner.SelectedIndex;
else if (index == owner.SelectedIndex)
owner.SelectedIndex = -1;
object removed = object_items [index];
@@ -35,23 +35,27 @@ namespace System.Windows.Forms
[DefaultEvent ("Opening")]
public class ContextMenuStrip : ToolStripDropDownMenu
{
internal Control AssociatedControl;
Control source_control;
internal Control container;
#region Public Construtors
public ContextMenuStrip () : base ()
{
source_control = null;
}
public ContextMenuStrip (IContainer container) : this ()
public ContextMenuStrip (IContainer container) : base ()
{
// TODO: handle `container` argument
source_control = null;
}
#endregion
#region Public Properties
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public Control SourceControl { get; protected set; }
public Control SourceControl {
get { return this.source_control; }
}
#endregion
#region Protected Methods
@@ -66,12 +70,11 @@ namespace System.Windows.Forms
if (visible)
XplatUI.SetTopmost (this.Handle, true);
}
protected override void SetOwnerControl (Control control)
{
base.SetOwnerControl (control);
SourceControl = control;
}
#endregion
internal void SetSourceControl (Control source_control)
{
container = this.source_control = source_control;
}
}
}
@@ -1246,7 +1246,7 @@ namespace System.Windows.Forms
} else {
if (!active_tracker.OnMouseDown (args)) {
Control control = GetRealChildAtPoint (Cursor.Position);
if (control != null && control.Visible && control.Enabled) {
if (control != null) {
Point pt = control.PointToClient (Cursor.Position);
XplatUI.SendMessage (control.Handle,
(Msg)m.Msg,
@@ -1406,7 +1406,8 @@ namespace System.Windows.Forms
if (background_image == null) {
if (!tbstyle_flat) {
Rectangle paintRect = pevent.ClipRectangle;
pevent.Graphics.FillRectangle(BackColorBrush, paintRect);
Brush pen = ThemeEngine.Current.ResPool.GetSolidBrush(BackColor);
pevent.Graphics.FillRectangle(pen, paintRect);
}
return;
}
@@ -1416,8 +1417,8 @@ namespace System.Windows.Forms
void DrawBackgroundImage (Graphics g) {
Rectangle drawing_rectangle = new Rectangle ();
g.FillRectangle (BackColorBrush, ClientRectangle);
g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), ClientRectangle);
switch (backgroundimage_layout)
{
case ImageLayout.Tile:
@@ -2266,9 +2267,6 @@ namespace System.Windows.Forms
return false;
}
if (!is_visible || !is_enabled)
return false;
parent = this;
while (parent != null) {
if (!parent.is_visible || !parent.is_enabled) {
@@ -2425,7 +2423,7 @@ namespace System.Windows.Forms
if (this.context_menu_strip != value) {
this.context_menu_strip = value;
if (value != null)
value.AssociatedControl = this;
value.container = this;
OnContextMenuStripChanged (EventArgs.Empty);
}
}
@@ -3468,8 +3466,6 @@ namespace System.Windows.Forms
}
}
protected SolidBrush BackColorBrush => ThemeEngine.Current.ResPool.GetSolidBrush (BackColor);
#endregion // Protected Instance Properties
#region Public Static Methods
@@ -4842,8 +4838,6 @@ namespace System.Windows.Forms
XplatUI.SetVisible (Handle, is_visible, true);
if (!is_visible) {
if (parent != null && parent.IsHandleCreated) {
if (InternalContainsFocus)
parent.SelectNextControl(this, true, true, true, true);
parent.Invalidate (bounds);
parent.Update ();
} else {
@@ -5383,12 +5377,6 @@ namespace System.Windows.Forms
}
private void WmMButtonUp (ref Message m) {
// Menu handle.
if (XplatUI.IsEnabled (Handle) && active_tracker != null) {
ProcessActiveTracker (ref m);
return;
}
MouseEventArgs me;
me = new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Middle,
@@ -5407,12 +5395,6 @@ namespace System.Windows.Forms
}
private void WmMButtonDown (ref Message m) {
// Menu handle.
if (XplatUI.IsEnabled (Handle) && active_tracker != null) {
ProcessActiveTracker (ref m);
return;
}
InternalCapture = true;
OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
@@ -5498,21 +5480,22 @@ namespace System.Windows.Forms
return;
}
// If there isn't a regular context menu, show the Strip version
if (context_menu == null && context_menu_strip != null) {
Point pt;
// If there isn't a regular context menu, show the Strip version
if (context_menu == null && context_menu_strip != null) {
Point pt;
pt = new Point (LowOrder ((int)m.LParam.ToInt32 ()), HighOrder ((int)m.LParam.ToInt32 ()));
if (pt.X == -1 || pt.Y == -1) {
pt.X = (this.Width / 2) + this.Left;
pt.Y = (this.Height /2) + this.Top;
pt = this.PointToScreen (pt);
pt = new Point (LowOrder ((int)m.LParam.ToInt32 ()), HighOrder ((int)m.LParam.ToInt32 ()));
if (pt.X == -1 || pt.Y == -1) {
pt.X = (this.Width / 2) + this.Left;
pt.Y = (this.Height /2) + this.Top;
pt = this.PointToScreen (pt);
}
context_menu_strip.SetSourceControl (this);
context_menu_strip.Show (this, PointToClient (pt));
return;
}
context_menu_strip.Show (this, PointToClient (pt));
return;
}
DefWndProc(ref m);
}
@@ -6499,6 +6482,7 @@ namespace System.Windows.Forms
remove { Events.RemoveHandler (ContextMenuStripChangedEvent, value);}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
[Browsable(true)]
public event ControlEventHandler ControlAdded {
@@ -370,11 +370,11 @@ namespace System.Windows.Forms {
ThemeEngine.Current.CPDrawContainerGrabHandle (graphics, bounds);
}
public static void DrawFocusRectangle(Graphics graphics, Rectangle rectangle) {
public static void DrawFocusRectangle( Graphics graphics, Rectangle rectangle) {
DrawFocusRectangle(graphics, rectangle, SystemColors.Control, SystemColors.ControlText);
}
public static void DrawFocusRectangle(Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor) {
public static void DrawFocusRectangle( Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor) {
ThemeEngine.Current.CPDrawFocusRectangle (graphics, rectangle, foreColor, backColor);
}
@@ -108,7 +108,6 @@ namespace System.Windows.Forms {
cell.defaultNewRowValue = this.defaultNewRowValue;
cell.description = this.description;
cell.valueIsIcon = this.valueIsIcon;
cell.imageLayout = this.imageLayout;
return cell;
}
@@ -56,7 +56,6 @@ namespace System.Windows.Forms
clone.linkBehavior = this.linkBehavior;
clone.visited_link_color = this.visited_link_color;
clone.trackVisitedState = this.trackVisitedState;
clone.useColumnTextForLinkValue = this.useColumnTextForLinkValue;
return clone;
}
@@ -77,8 +77,7 @@ namespace System.Windows.Forms
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
template.ActiveLinkColor = value;
if (DataGridView == null)
return;
foreach (DataGridViewRow row in DataGridView.Rows) {
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
if (cell != null)
@@ -114,8 +113,6 @@ namespace System.Windows.Forms
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
template.LinkBehavior = value;
if (DataGridView == null)
return;
foreach (DataGridViewRow row in DataGridView.Rows)
{
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
@@ -140,8 +137,6 @@ namespace System.Windows.Forms
if (template == null)
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
template.LinkColor = value;
if (DataGridView == null)
return;
foreach (DataGridViewRow row in DataGridView.Rows)
{
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
@@ -155,20 +150,20 @@ namespace System.Windows.Forms
[DefaultValue ((string) null)]
public string Text {
get {
DataGridViewLinkCell template = CellTemplate as DataGridViewLinkCell;
if (template == null)
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
return text;
}
set {
if (this.Text == value)
return;
DataGridViewLinkCell template = CellTemplate as DataGridViewLinkCell;
if (template == null)
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
//TODO : sets the Text property of every cell in the column
//TODO only if UseColumnTextForLinkValue is true
text = value;
if (DataGridView == null)
return;
foreach (DataGridViewRow row in DataGridView.Rows)
{
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
if (cell != null && cell.UseColumnTextForLinkValue)
cell.Value = value;
}
DataGridView.InvalidateColumn (Index);
}
}
@@ -189,8 +184,6 @@ namespace System.Windows.Forms
if (template == null)
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
template.TrackVisitedState = value;
if (DataGridView == null)
return;
foreach (DataGridViewRow row in DataGridView.Rows)
{
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
@@ -217,8 +210,6 @@ namespace System.Windows.Forms
if (template == null)
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
template.UseColumnTextForLinkValue = value;
if (DataGridView == null)
return;
foreach (DataGridViewRow row in DataGridView.Rows)
{
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
@@ -244,8 +235,6 @@ namespace System.Windows.Forms
if (template == null)
throw new InvalidOperationException ("CellTemplate is null when getting this property.");
template.VisitedLinkColor = value;
if (DataGridView == null)
return;
foreach (DataGridViewRow row in DataGridView.Rows)
{
DataGridViewLinkCell cell = row.Cells[Index] as DataGridViewLinkCell;
@@ -102,7 +102,6 @@ namespace System.Windows.Forms {
private bool autoscale_base_size_set;
internal ArrayList disabled_by_showdialog = new ArrayList();
internal static ArrayList modal_dialogs = new ArrayList();
internal bool dialog_result_changed;
#endregion // Local Variables
#region Private & Internal Methods
@@ -201,11 +200,7 @@ namespace System.Windows.Forms {
internal override void UpdateWindowText ()
{
var old_clientsize = ClientSize;
if (!IsHandleCreated) {
if (is_clientsize_set)
ClientSize = old_clientsize;
return;
}
@@ -217,9 +212,6 @@ namespace System.Windows.Forms {
}
XplatUI.Text (Handle, Text.Replace (Environment.NewLine, string.Empty));
if (ClientSize != old_clientsize)
ClientSize = old_clientsize;
}
internal void SelectActiveControl ()
@@ -243,7 +235,7 @@ namespace System.Windows.Forms {
this.is_visible = visible;
} else {
SendControlFocus (ActiveControl);
Select (ActiveControl);
}
}
@@ -603,7 +595,7 @@ namespace System.Windows.Forms {
set {
if (control_box != value) {
control_box = value;
UpdateFormStyles();
UpdateStyles();
}
}
}
@@ -645,7 +637,6 @@ namespace System.Windows.Forms {
typeof (DialogResult));
dialog_result = value;
dialog_result_changed = true;
if (dialog_result != DialogResult.None && is_modal)
RaiseCloseEvents (false, false); // .Net doesn't send WM_CLOSE here.
}
@@ -669,10 +660,15 @@ namespace System.Windows.Forms {
window_manager.UpdateBorderStyle (value);
}
UpdateFormStyles();
Size current_client_size = ClientSize;
UpdateStyles();
if (this.IsHandleCreated)
if (this.IsHandleCreated) {
this.Size = InternalSizeFromClientSize (current_client_size);
XplatUI.InvalidateNC (this.Handle);
} else if (is_clientsize_set) {
this.Size = InternalSizeFromClientSize (current_client_size);
}
}
}
@@ -1101,8 +1097,6 @@ namespace System.Windows.Forms {
XplatUI.SetOwner(this.window.Handle, IntPtr.Zero);
}
}
// UIA Framework: Raises internal event
OnUIAOwnerChanged ();
}
}
}
@@ -1126,7 +1120,7 @@ namespace System.Windows.Forms {
set {
if (this.show_icon != value ) {
this.show_icon = value;
UpdateFormStyles ();
UpdateStyles ();
if (IsHandleCreated) {
XplatUI.SetIcon (this.Handle, value == true ? this.Icon : null);
@@ -2199,7 +2193,7 @@ namespace System.Windows.Forms {
if (keyData == Keys.Enter) {
IntPtr window = XplatUI.GetFocus ();
Control c = Control.FromHandle (window);
if (c is Button && c.Visible && c.Enabled && c.FindForm () == this) {
if (c is Button && c.FindForm () == this) {
((Button)c).PerformClick ();
return true;
}
@@ -2896,13 +2890,6 @@ namespace System.Windows.Forms {
is_loaded = true;
}
private void UpdateFormStyles() {
var old_clientsize = ClientSize;
UpdateStyles();
if ((!IsHandleCreated && is_clientsize_set) || ClientSize != old_clientsize)
ClientSize = old_clientsize;
}
private void UpdateMinMax()
{
var min_size = AutoSize ? new Size (Math.Max (minimum_auto_size.Width, minimum_size.Width), Math.Max (minimum_auto_size.Height, minimum_size.Height)) : minimum_size;
@@ -3213,7 +3200,6 @@ namespace System.Windows.Forms {
static object UIAMenuChangedEvent = new object ();
static object UIATopMostChangedEvent = new object ();
static object UIAWindowStateChangedEvent = new object ();
static object UIAOwnerChangedEvent = new object ();
internal event EventHandler UIAMenuChanged {
add { Events.AddHandler (UIAMenuChangedEvent, value); }
@@ -3230,11 +3216,6 @@ namespace System.Windows.Forms {
remove { Events.RemoveHandler (UIAWindowStateChangedEvent, value); }
}
internal event EventHandler UIAOwnerChanged {
add { Events.AddHandler (UIAOwnerChangedEvent, value); }
remove { Events.RemoveHandler (UIAOwnerChangedEvent, value); }
}
internal void OnUIAMenuChanged (EventArgs e)
{
EventHandler eh = (EventHandler) Events [UIAMenuChangedEvent];
@@ -3255,13 +3236,6 @@ namespace System.Windows.Forms {
if (eh != null)
eh (this, EventArgs.Empty);
}
internal void OnUIAOwnerChanged ()
{
EventHandler eh = (EventHandler) Events [UIAOwnerChangedEvent];
if (eh != null)
eh (this, EventArgs.Empty);
}
#endregion // UIA Framework Events
#endregion // Events
}
@@ -307,12 +307,28 @@ namespace System.Windows.Forms
#region Internal Methods
internal override Size GetPreferredSizeCore (Size proposedSize)
{
// (Copied from Panel)
// Translating 0, 0 from ClientSize to actual Size tells us how much space
// is required for the borders.
Size borderSize = SizeFromClientSize(Size.Empty);
Size totalPadding = borderSize + Padding.Size;
return LayoutEngine.GetPreferredSize(this, proposedSize - totalPadding) + totalPadding;
Size retsize = new Size (Padding.Left, Padding.Top);
foreach (Control child in Controls) {
if (child.Dock == DockStyle.Fill) {
if (child.Bounds.Right > retsize.Width)
retsize.Width = child.Bounds.Right;
} else if (child.Dock != DockStyle.Top && child.Dock != DockStyle.Bottom && (child.Bounds.Right + child.Margin.Right) > retsize.Width)
retsize.Width = child.Bounds.Right + child.Margin.Right;
if (child.Dock == DockStyle.Fill) {
if (child.Bounds.Bottom > retsize.Height)
retsize.Height = child.Bounds.Bottom;
} else if (child.Dock != DockStyle.Left && child.Dock != DockStyle.Right && (child.Bounds.Bottom + child.Margin.Bottom) > retsize.Height)
retsize.Height = child.Bounds.Bottom + child.Margin.Bottom;
}
retsize.Width += Padding.Right;
retsize.Height += Padding.Bottom;
retsize.Height += this.Font.Height;
return retsize;
}
#endregion
@@ -21,7 +21,6 @@
//
// Authors:
// Peter Bartok [email protected]
// Karl Scowen <[email protected]>
//
//
@@ -45,20 +44,14 @@ namespace System.Windows.Forms
internal int line_no; // Line number
internal LineTag tags; // Tags describing the text
internal int offset; // Baseline can be on the X or Y axis depending if we are in multiline mode or not
internal int height; // Total height of the line, including TotalParagraphSpacing and LineSpacing
private int textHeight; // Height of the line without spacing.
internal int ascent; // Ascent of the line (highest distance above the baseline, including character offset)
internal int height; // Height of the line (height of tallest tag)
internal int ascent; // Ascent of the line (ascent of the tallest tag)
internal HorizontalAlignment alignment; // Alignment of the line
internal int align_shift; // Pixel shift caused by the alignment
internal float indent; // Left indent for the first line
internal float hanging_indent; // Hanging indent (difference between first line indent and other lines)
internal float right_indent; // Right indent for all lines
internal int indent; // Left indent for the first line
internal int hanging_indent; // Hanging indent (left indent for all but the first line)
internal int right_indent; // Right indent for all lines
internal LineEnding ending;
internal float spacing_before;
internal float spacing_after;
internal float line_spacing;
internal bool line_spacing_multiple;
internal TabStopCollection tab_stops; // Custom tabstops for this paragraph.
// Stuff that's important for the tree
internal Line parent; // Our parent line
@@ -93,11 +86,10 @@ namespace System.Windows.Forms
text = new StringBuilder (Text, space);
line_no = LineNo;
this.ending = ending;
tab_stops = new TabStopCollection();
widths = new float[space + 1];
tags = new LineTag(this, 1);
tags.Font = font;
tags.Color = color;
@@ -111,7 +103,6 @@ namespace System.Windows.Forms
line_no = LineNo;
this.ending = ending;
alignment = align;
tab_stops = new TabStopCollection();
widths = new float[space + 1];
@@ -121,38 +112,6 @@ namespace System.Windows.Forms
tags.Color = color;
}
internal Line (Document document, int LineNo, string Text, HorizontalAlignment align, Font font, Color color,
Color back_color, TextPositioning text_position, float char_offset, float left_indent, float hanging_indent,
float right_indent, float spacing_before, float spacing_after, float line_spacing, bool line_spacing_multiple,
TabStopCollection tab_stops, bool visible, LineEnding ending) : this(document, ending)
{
space = Text.Length > DEFAULT_TEXT_LEN ? Text.Length+1 : DEFAULT_TEXT_LEN;
text = new StringBuilder (Text, space);
line_no = LineNo;
this.ending = ending;
alignment = align;
indent = left_indent;
HangingIndent = hanging_indent;
this.right_indent = right_indent;
this.spacing_before = spacing_before;
this.spacing_after = spacing_after;
this.tab_stops = tab_stops;
this.line_spacing = line_spacing;
this.line_spacing_multiple = line_spacing_multiple;
widths = new float[space + 1];
tags = new LineTag(this, 1);
tags.Font = font;
tags.Color = color;
tags.BackColor = back_color;
tags.TextPosition = text_position;
tags.CharOffset = char_offset;
tags.Visible = visible;
}
internal Line (Document document, int LineNo, string Text, LineTag tag, LineEnding ending) : this(document, ending)
{
space = Text.Length > DEFAULT_TEXT_LEN ? Text.Length+1 : DEFAULT_TEXT_LEN;
@@ -178,10 +137,10 @@ namespace System.Windows.Forms
}
}
internal float HangingIndent {
internal int HangingIndent {
get { return hanging_indent; }
set {
this.hanging_indent = value;
hanging_indent = value;
recalc = true;
}
}
@@ -192,63 +151,7 @@ namespace System.Windows.Forms
set { height = value; }
}
internal int TextHeight {
get {
return textHeight;
}
}
internal TabStopCollection TabStops {
get { return tab_stops; }
set { tab_stops = value; }
}
internal float TotalParagraphSpacing {
get {
return SpacingBefore + SpacingAfter;
}
}
internal float LineSpacing {
get {
if (textHeight == 0) {
throw new InvalidOperationException("Can't get LineSpacing when the line height isn't calculated!");
}
if (line_spacing < 0) {
return -line_spacing;
} else if (line_spacing_multiple) {
return line_spacing * textHeight * 6f / document.Dpi;
} else {
return Math.Max(line_spacing, textHeight);
}
}
}
internal float SpacingBefore {
get {
bool has_spacing = true;
if (line_no > 1) {
Line previous_line = document.GetLine(line_no - 1);
if (previous_line != null && (previous_line.ending == LineEnding.Wrap || previous_line.ending == LineEnding.None))
has_spacing = false;
}
if (has_spacing)
return spacing_before;
else
return 0;
}
}
internal float SpacingAfter {
get {
if (ending == LineEnding.Wrap)
return 0;
else
return spacing_after;
}
}
internal float Indent {
internal int Indent {
get { return indent; }
set {
indent = value;
@@ -261,7 +164,7 @@ namespace System.Windows.Forms
set { line_no = value; }
}
internal float RightIndent {
internal int RightIndent {
get { return right_indent; }
set {
right_indent = value;
@@ -351,7 +254,7 @@ namespace System.Windows.Forms
return;
// Find the first tag that we are deleting from
tag = FindTag (pos);
tag = FindTag (pos + 1);
// Remove the characters from the line
text.Remove (pos, count);
@@ -368,10 +271,10 @@ namespace System.Windows.Forms
left = count;
left -= tag.Start + tag.Length - pos - 1;
tag = tag.Next;
// Update the start of each tag
while ((tag.Next != null) && (left > 0)) {
tag = tag.Next;
while ((tag != null) && (left > 0)) {
// Cache tag.Length as is will be indireclty modified
// by changes to tag.Start
int tag_length = tag.Length;
@@ -381,6 +284,7 @@ namespace System.Windows.Forms
left = 0;
} else {
left -= tag_length;
tag = tag.Next;
}
}
@@ -391,7 +295,15 @@ namespace System.Windows.Forms
streamline = true;
}
// Delete empty orphaned tags at the end
LineTag walk = tag;
while (walk != null && walk.Next != null && walk.Next.Length == 0) {
LineTag t = walk;
walk.Next = walk.Next.Next;
if (walk.Next != null)
walk.Next.Previous = t;
walk = walk.Next;
}
// Adjust the start point of any tags following
if (tag != null) {
@@ -402,15 +314,6 @@ namespace System.Windows.Forms
}
}
// Delete empty orphaned tags at the end. Do this after adjusting their starts, otherwise we might delete tags that acutally do have content.
while (walk != null && walk.Next != null && walk.Next.Length == 0) {
LineTag t = walk;
walk.Next = walk.Next.Next;
if (walk.Next != null)
walk.Next.Previous = t;
walk = walk.Next;
}
recalc = true;
if (streamline)
@@ -458,7 +361,7 @@ namespace System.Windows.Forms
pos = text.Length - 1;
while (tag != null) {
if (((tag.Start - 1) <= pos) && (pos < (tag.Start + tag.Length - 1)))
if (((tag.Start - 1) <= pos) && (pos <= (tag.Start + tag.Length - 1)))
return LineTag.GetFinalTag (tag);
tag = tag.Next;
@@ -531,33 +434,6 @@ namespace System.Windows.Forms
// Insert the text into the StringBuilder
text.Insert (pos, s);
// Check that tag is still in use in the line. If not, then we choose the last tag at that position.
LineTag t = tags;
while (t != null) {
if (((t.Start - 1) <= pos) && (pos < (t.End - 1) || (pos == t.End - 1 && t.Length == 0))) {
// found the location
bool foundTag = false;
while (pos < (t.Start + t.Length - 1)) {
if (t == tag) {
foundTag = true;
break;
}
if (t.Next == null)
break;
t = t.Next;
}
if (!foundTag) {
if (pos < (t.Start + t.Length - 1)) {
tag = t.Previous;
} else {
tag = t;
}
}
break;
}
t = t.Next;
}
// Update the start position of every tag after this one
tag = tag.Next;
@@ -578,95 +454,56 @@ namespace System.Windows.Forms
/// returns true if lineheight changed
/// </summary>
internal bool RecalculateLine (Graphics g, Document doc)
{
return RecalculateLine (g, doc, kerning_fonts.ContainsKey (tags.Font.GetHashCode ()));
}
private bool RecalculateLine (Graphics g, Document doc, bool handleKerning)
{
LineTag tag;
int pos;
int len;
Font currentFont;
int currentFontStart;
SizeF size;
float w;
int prev_offset;
bool retval;
bool wrapped;
bool first_in_para;
Line line;
int wrap_pos;
int prev_wrap_pos;
int prev_height;
int prev_ascent;
float prev_spacing_before;
int max_above_baseline;
int max_below_baseline;
int total_ascent;
int total_descent;
TabStop lastTab;
int lastTabPos;
char c;
bool handleKerning;
float right_indent;
float add_width;
pos = 0;
len = this.text.Length;
currentFont = tags.FontToDisplay;
currentFontStart = 0;
tag = this.tags;
prev_offset = this.offset; // For drawing optimization calculations
prev_height = this.height;
prev_ascent = this.ascent;
prev_spacing_before = this.SpacingBefore;
max_above_baseline = 0;
max_below_baseline = 0;
total_ascent = 0;
total_descent = 0;
lastTab = null;
lastTabPos = 0;
this.height = 0; // Reset line height
this.ascent = 0; // Reset the ascent for the line
tag.Shift = 0; // Reset shift (which should be stored as pixels, not as points)
right_indent = Math.Max(this.right_indent, 0); // Ignore any negative right indent.
if (line_no > 0) {
line = doc.GetLine (LineNo - 1);
first_in_para = line != null && line.ending != LineEnding.Wrap;
} else {
first_in_para = true;
}
if (first_in_para)
widths [0] = indent;
if (ending == LineEnding.Wrap)
widths[0] = document.left_margin + hanging_indent;
else
widths [0] = indent + hanging_indent;
if (widths [0] < 0)
widths [0] = 0; // Don't allow a negative indent to take the line to a negative position.
widths [0] += document.left_margin;
widths[0] = document.left_margin + indent;
this.recalc = false;
retval = false;
wrapped = false;
wrap_pos = 0;
prev_wrap_pos = 0;
handleKerning = kerning_fonts.ContainsKey (currentFont.GetHashCode ());
add_width = 0;
while (pos < len) {
while (tag.Length == 0) { // We should always have tags after a tag.length==0 unless len==0
//tag.Ascent = 0;
tag.Shift = (tag.Line.ascent - tag.Ascent); // / 72;
tag.Shift = (tag.Line.ascent - tag.Ascent) / 72;
tag = tag.Next;
if (tag.Length != 0 && tag.FontToDisplay != currentFont) {
CheckKerning (g, currentFont, currentFontStart, pos - currentFontStart);
currentFont = tag.FontToDisplay;
currentFontStart = pos;
handleKerning = kerning_fonts.ContainsKey (currentFont.GetHashCode ());
}
}
c = text [pos];
// kerning is a problem. The original code in this method assumed that the
// width of a string equals the sum of the widths of its characters. This is
// not true when kerning takes place during the display process. Since it's
@@ -683,103 +520,44 @@ namespace System.Windows.Forms
// MeasureText doesn't measure trailing spaces, so we do the best we can for those
// in the else branch.
// It doesn't measure /t characters either, we need to add it manually with add_width.
size = TextBoxTextRenderer.MeasureText (g, text.ToString (currentFontStart, pos + 1 - currentFontStart), currentFont);
newWidth = widths [currentFontStart] + size.Width;
size = TextBoxTextRenderer.MeasureText (g, text.ToString (0, pos + 1), tag.Font);
newWidth = widths[0] + size.Width + add_width;
}
else if (c != '\t') {
else
{
size = tag.SizeOfPosition (g, pos);
w = size.Width;
newWidth = widths[pos] + w;
} else {
CheckKerning (g, currentFont, currentFontStart, pos - currentFontStart);
currentFontStart = pos + 1; // Don't try handling the tab along with kerned text.
if (lastTab != null) {
ProcessLastTab (lastTab, lastTabPos, pos);
lastTab = null;
}
float l = widths [pos];
w = -1;
for (int i = 0; i < tab_stops.Count; i++) {
if (tab_stops [i].Position > l) {
lastTab = tab_stops [i];
lastTabPos = pos;
w = lastTab.GetInitialWidth (this, pos);
break;
}
}
if (w < 0) {
w = tag.SizeOfPosition (g, pos).Width;
}
newWidth = widths [pos] + w;
if (text[pos] == '\t') add_width += w;
}
if (doc.Wrap) {
// FIXME: Technically there are multiple no-break spaces, not just the main one.
if ((Char.IsWhiteSpace (c) && c != '\u00A0') || c == '-' || c == '\u2013' || c == '\u2014') {
// Primarily break on dashes or whitespace other than a no-break space.
prev_wrap_pos = wrap_pos;
if (c == '\t') {
wrap_pos = pos; // Wrap before tabs for some reason.
} else {
wrap_pos = pos + 1;
}
}
if (Char.IsWhiteSpace (text[pos]))
wrap_pos = pos + 1;
if (newWidth > (doc.viewport_width - this.right_indent)) {
LineTag split_tag = null;
if (wrap_pos > 0) {
// Make sure to set the last width of the line before wrapping
widths [pos + 1] = newWidth;
if (doc.wrap) {
if ((wrap_pos > 0) && (wrap_pos != len) && (newWidth + 5) > (doc.viewport_width - this.right_indent)) {
// Make sure to set the last width of the line before wrapping
widths[pos + 1] = newWidth;
if (Char.IsWhiteSpace (c)) {
if (wrap_pos > pos) {
while (wrap_pos < text.Length && Char.IsWhiteSpace (text [wrap_pos]) && text [wrap_pos] != '\t') {
wrap_pos++;
}
pos++;
wrapped = true;
// don't try pulling more into this line, but keep looping to deal with the rest of the widths and tags
}
} else {
if (wrap_pos > pos && pos > 0) {
// We're at a dash (otherwise we'd be above), but don't have room to fit it in.
// Wrap at the previous wrap point if possible.
wrap_pos = prev_wrap_pos > 0 ? prev_wrap_pos : pos;
}
split_tag = tag;
pos = wrap_pos;
}
} else if (pos > 0) {
// No suitable wrap position was found so break right in the middle of a word
pos = wrap_pos;
len = text.Length;
doc.Split (this, tag, pos);
ending = LineEnding.Wrap;
len = this.text.Length;
// Make sure to set the last width of the line before wrapping
widths [pos + 1] = newWidth;
retval = true;
wrapped = true;
} else if (pos > 1 && newWidth > (doc.viewport_width - this.right_indent)) {
// No suitable wrap position was found so break right in the middle of a word
split_tag = tag;
} // Else don't wrap -- pos == 0, so we'd infinite loop adding blank lines before this.
// Make sure to set the last width of the line before wrapping
widths[pos + 1] = newWidth;
if (split_tag != null) {
if (lastTab != null) {
ProcessLastTab (lastTab, lastTabPos, pos);
lastTab = null;
}
while (pos < split_tag.Start)
split_tag = split_tag.Previous;
// We have to pass Split the correct tag, and that can change if pos
// is set somewhere before the tag change (e.g. by wrap_pos).
doc.Split (this, split_tag, pos);
ending = LineEnding.Wrap;
len = this.text.Length;
retval = true;
wrapped = true;
}
doc.Split (this, tag, pos);
ending = LineEnding.Wrap;
len = this.text.Length;
retval = true;
wrapped = true;
}
}
@@ -791,23 +569,12 @@ namespace System.Windows.Forms
if (pos == len) {
line = doc.GetLine (this.line_no + 1);
do {
if ((line != null) && (ending == LineEnding.Wrap || ending == LineEnding.None) &&
(widths[pos] < (doc.viewport_width - this.right_indent) || line.text.Length == 0)) {
// Pull the two lines together
// Only do this if the line isn't already full, or the next line is empty.
var h = this.height; // Back up h, because Combine sets it to zero.
doc.Combine (this, line);
this.height = h; // And restore it. There's no point starting at the start again.
// Document.Combine() called Line.Streamline(), so it is possible tag points a tag that got removed.
tag = FindTag (pos - 1); // So make sure we've got the correct tag.
len = this.text.Length;
line = doc.GetLine (this.line_no + 1);
retval = true;
}
} while ((ending == LineEnding.Wrap || ending == LineEnding.None) && line != null && line.text.Length == 0);
// If the next line is empty, do it again (if possible).
// The amount of room on this line doesn't matter when there's no text being added...
if ((line != null) && (ending == LineEnding.Wrap || ending == LineEnding.None)) {
// Pull the two lines together
doc.Combine (this.line_no, this.line_no + 1);
len = this.text.Length;
retval = true;
}
}
}
@@ -815,63 +582,54 @@ namespace System.Windows.Forms
// We just found the end of our current tag
tag.Height = tag.MaxHeight ();
/* line.ascent is the highest point above the baseline.
* total_ascent will equal the maximum distance of the tag above the baseline.
* total_descent is needed to calculate the line height.
* tag.Shift does not include tag.CharOffset, because Shift puts the tag
* on the baseline, while CharOffset moves the baseline.
* However, we move the normal baseline when CharOffset is trying to push
* stuff off the top.
*/
total_ascent = tag.Ascent + (int)tag.CharOffset;
total_descent = tag.Descent - (int)tag.CharOffset; // gets bigger as CharOffset gets smaller
if (total_ascent > max_above_baseline) {
int moveBy = total_ascent - max_above_baseline;
max_above_baseline = total_ascent;
// Check if we're the tallest on the line (so far)
if (tag.Height > this.height)
this.height = tag.Height; // Yep; make sure the line knows
LineTag t = tags;
if (tag.Ascent > this.ascent) {
LineTag t;
// We have a tag that has a taller ascent than the line;
t = tags;
while (t != null && t != tag) {
t.Shift += moveBy;
t.Shift = (tag.Ascent - t.Ascent) / 72;
t = t.Next;
}
tag.Shift = (int)tag.CharOffset;
this.ascent = max_above_baseline;
// Save on our line
this.ascent = tag.Ascent;
} else {
tag.Shift = (this.ascent - tag.Ascent);
tag.Shift = (this.ascent - tag.Ascent) / 72;
}
if (total_descent > max_below_baseline)
max_below_baseline = total_descent;
if (this.height < max_above_baseline + max_below_baseline + tag.Height - tag.Ascent - tag.Descent)
this.height = max_above_baseline + max_below_baseline + tag.Height - tag.Ascent - tag.Descent;
tag = tag.Next;
if (tag != null) {
if (tag.Length != 0 && tag.FontToDisplay != currentFont) {
CheckKerning (g, currentFont, currentFontStart, pos - currentFontStart);
currentFont = tag.FontToDisplay;
currentFontStart = pos;
handleKerning = kerning_fonts.ContainsKey (currentFont.GetHashCode ());
}
tag.Shift = 0;
// We can't just wrap on tag boundaries -- e.g. if the first letter of the word has a different colour / font.
wrap_pos = pos;
}
}
}
if (pos != currentFontStart) {
CheckKerning (g, currentFont, currentFontStart, pos - currentFontStart);
var fullText = text.ToString();
if (!handleKerning && fullText.Length > 1 && !wrapped)
{
// Check whether kerning takes place for this string and font.
var realSize = TextBoxTextRenderer.MeasureText(g, fullText, tags.Font);
float realWidth = realSize.Width + widths[0];
// MeasureText ignores trailing whitespace, so we will too at this point.
int length = fullText.TrimEnd().Length;
float sumWidth = widths[length];
if (realWidth != sumWidth)
{
kerning_fonts.Add(tags.Font.GetHashCode (), true);
// Using a slightly incorrect width this time around isn't that bad. All that happens
// is that the cursor is a pixel or two off until the next character is typed. It's
// the accumulation of pixel after pixel that causes display problems.
}
}
if (lastTab != null) {
ProcessLastTab (lastTab, lastTabPos, pos);
lastTab = null;
}
while (tag != null) {
tag.Shift = (tag.Line.ascent - tag.Ascent); // / 72;
while (tag != null) {
tag.Shift = (tag.Line.ascent - tag.Ascent) / 72;
tag = tag.Next;
}
@@ -881,49 +639,12 @@ namespace System.Windows.Forms
tags.Shift = 0;
}
this.textHeight = this.height;
this.height = (int)(this.LineSpacing + this.TotalParagraphSpacing);
if (prev_offset != offset || prev_height != this.height || prev_ascent != this.ascent ||
Math.Abs (prev_spacing_before - this.SpacingBefore) > document.Dpi / 1440f)
if (prev_offset != offset || prev_height != this.height || prev_ascent != this.ascent)
retval = true;
return retval;
}
private void ProcessLastTab (TabStop tab, int tab_pos, int pos)
{
float prevTabRight = widths[tab_pos + 1];
float tabRight = tab.CalculateRight (this, tab_pos);
float change = tabRight - prevTabRight;
for (int i = tab_pos + 1; i <= pos; i++) {
widths[i] += change;
}
}
private void CheckKerning (Graphics g, Font font, int start, int length)
{
if (length > 1) {
if (!kerning_fonts.ContainsKey (font.GetHashCode ())) {
// Check whether kerning takes place for this string and font.
var partText = text.ToString(start, length);
var realSize = TextBoxTextRenderer.MeasureText(g, partText, font);
float realWidth = realSize.Width + widths[start + 1];
// MeasureText ignores trailing whitespace, so we will too at this point.
int textLength = partText.TrimEnd().Length;
float sumWidth = widths[textLength + start + 1];
if (realWidth != sumWidth)
{
kerning_fonts.Add(font.GetHashCode (), true);
// Using a slightly incorrect width this time around isn't that bad. All that happens
// is that the cursor is a pixel or two off until the next character is typed. It's
// the accumulation of pixel after pixel that causes display problems.
}
}
}
}
/// <summary>
/// Recalculate a single line using the same char for every character in the line
/// </summary>
@@ -946,14 +667,13 @@ namespace System.Windows.Forms
w = TextBoxTextRenderer.MeasureText (g, doc.password_char, tags.Font).Width;
if (this.textHeight != (int)tag.Font.Height)
if (this.height != (int)tag.Font.Height)
ret = true;
else
ret = false;
this.textHeight = (int)tag.Font.Height;
tag.Height = this.textHeight;
this.height = (int)(this.textHeight + this.LineSpacing + this.TotalParagraphSpacing);
this.height = (int)tag.Font.Height;
tag.Height = this.height;
this.ascent = tag.Ascent;
@@ -964,42 +684,7 @@ namespace System.Windows.Forms
return ret;
}
internal void CalculateAlignment ()
{
var alignmentWidth = document.ViewPortWidth - document.left_margin - document.right_margin;
var alignmentLineWidth = GetAlignmentLineWidth ();
switch (alignment) {
case HorizontalAlignment.Left:
align_shift = 0;
break;
case HorizontalAlignment.Center:
align_shift = (alignmentWidth - alignmentLineWidth) / 2;
break;
case HorizontalAlignment.Right:
align_shift = alignmentWidth - alignmentLineWidth;
break;
}
align_shift = Math.Max (align_shift, 0); // Don't allow negative shifts.
}
private int GetAlignmentLineWidth ()
{
int last = text.Length - 1;
if (last < 0)
return 0;
char c = text [last];
while (last > 0 && Char.IsWhiteSpace (c) && c != '\t' && c != '\u00A0') {
c = text [--last];
}
// widths[0] has both the left margin and the left indents.
// Remove the margin (it is part of the viewport) and add the right indents (part of the line width, for alignment purposes).
return (int)(widths [last + 1] - document.left_margin + Math.Max (right_indent, 0));
}
internal void Streamline (int lines)
{
LineTag current;
@@ -1026,7 +711,7 @@ namespace System.Windows.Forms
return;
while (next != null) {
// Take out 0 length tags unless it's the last tag in the document.
// Take out 0 length tags unless it's the last tag in the document
if (current.IsTextTag && next.Length == 0 && next.IsTextTag) {
if ((next.Next != null) || (line_no != lines)) {
current.Next = next.Next;
@@ -21,7 +21,6 @@
//
// Authors:
// Peter Bartok [email protected]
// Karl Scowen <[email protected]>
//
//
@@ -45,10 +44,6 @@ namespace System.Windows.Forms
private string link_text; // The full link text e.g. this might be
// word-wrapped to "w" but this would be
// "www.example.com"
private bool visible;
private TextPositioning text_position; // Normal / superscript / subscript
private Font small_font; // Cached font for superscript / subscript
private float char_offset; // Shift the text baseline up or down
// Payload; text
private int start; // start, in chars; index into Line.text
@@ -58,8 +53,7 @@ namespace System.Windows.Forms
private int height; // Height in pixels of the text this tag describes
private int ascent; // Ascent of the font for this tag
private int descent; // Descent of the font for this tag
private int shift; // Shift down for this tag, to stay on baseline.
// Measured from top of line to top of tag.
private int shift; // Shift down for this tag, to stay on baseline
// Administrative
private Line line; // The line we're on
@@ -75,7 +69,6 @@ namespace System.Windows.Forms
link_font = null;
is_link = false;
link_text = null;
visible = true;
}
#endregion // Constructors
@@ -120,16 +113,6 @@ namespace System.Windows.Forms
return link_font;
}
if (TextPosition != TextPositioning.Normal) {
if (small_font == null)
small_font = new Font (font.FontFamily, font.Size * 0.583F, font.Style);
if (IsLink)
return new Font (small_font, font.Style | FontStyle.Underline);
else
return small_font;
}
return font;
}
}
@@ -139,43 +122,20 @@ namespace System.Windows.Forms
set {
if (font != value) {
link_font = null;
small_font = null;
font = value;
height = Font.Height;
XplatUI.GetFontMetrics (Hwnd.GraphicsContext, Font, out ascent, out descent);
float scale_factor = font.GetHeight () / font.FontFamily.GetLineSpacing (font.Style);
ascent = (int) Math.Ceiling (ascent * scale_factor);
descent = (int) Math.Ceiling (descent * scale_factor);
line.recalc = true;
}
}
}
public TextPositioning TextPosition {
get { return text_position; }
set { text_position = value; }
}
public float CharOffset {
get { return char_offset; }
set { char_offset = value; }
}
public int Height {
get { return height; }
set { height = value; }
}
public int DrawnHeight {
get {
if (text_position != TextPositioning.Normal)
return (int) (height * 0.583F);
return height;
}
}
public virtual bool IsTextTag {
get { return true; }
}
@@ -226,7 +186,7 @@ namespace System.Windows.Forms
throw new Exception("New tag makes an insane tag");
}
#endif
start = value;
start = value;
}
}
@@ -246,14 +206,9 @@ namespace System.Windows.Forms
}
}
public bool Visible {
get { return visible; }
set { visible = value; }
}
public float Width {
get {
if (Length == 0 || !visible)
if (Length == 0)
return 0;
return line.widths [start + Length - 1] - (start != 0 ? line.widths [start - 1] : 0);
}
@@ -267,15 +222,6 @@ namespace System.Windows.Forms
}
}
public int OffsetY {
get {
if (text_position == TextPositioning.Subscript)
return (int) (height * 0.45F);
return 0;
}
}
public bool IsLink {
get { return is_link; }
set { is_link = value; }
@@ -307,8 +253,8 @@ namespace System.Windows.Forms
new_tag = new LineTag(line, pos);
new_tag.CopyFormattingFrom (this);
new_tag.Next = this.next;
this.Next = new_tag;
new_tag.next = this.next;
this.next = new_tag;
new_tag.previous = this;
if (new_tag.next != null)
@@ -323,7 +269,7 @@ namespace System.Windows.Forms
if (!this.Equals (other))
return false;
this.Next = other.next;
this.next = other.next;
if (this.next != null)
this.next.previous = this;
@@ -336,9 +282,6 @@ namespace System.Windows.Forms
Font = other.font;
color = other.color;
back_color = other.back_color;
TextPosition = other.text_position;
CharOffset = other.CharOffset;
Visible = other.Visible;
}
public void Delete ()
@@ -369,8 +312,6 @@ namespace System.Windows.Forms
public virtual void Draw (Graphics dc, Color color, float x, float y, int start, int end)
{
if (text_position == TextPositioning.Subscript)
y += OffsetY;
TextBoxTextRenderer.DrawText (dc, line.text.ToString (start, end).Replace ("\r", string.Empty), FontToDisplay, color, x, y, false);
}
@@ -387,14 +328,6 @@ namespace System.Windows.Forms
public virtual void Draw (Graphics dc, Color color, float xoff, float y, int drawStart, int drawEnd,
string text, out Rectangle measuredText, bool measureText)
{
if (!visible) {
measuredText = new Rectangle ();
return;
}
if (text_position == TextPositioning.Subscript)
y += OffsetY;
if (measureText) {
int xstart = (int)line.widths [drawStart] + (int)xoff;
int xend = (int)line.widths [drawEnd] - (int)line.widths [drawStart];
@@ -409,7 +342,7 @@ namespace System.Windows.Forms
while (drawStart < drawEnd) {
int tab_index = text.IndexOf ("\t", drawStart);
if (tab_index == -1 || tab_index > drawEnd)
if (tab_index == -1)
tab_index = drawEnd;
TextBoxTextRenderer.DrawText (dc, text.Substring (drawStart, tab_index - drawStart).Replace ("\r", string.Empty), FontToDisplay, color, xoff + line.widths [drawStart], y, false);
@@ -447,16 +380,7 @@ namespace System.Windows.Forms
if (this.LinkText != other.LinkText)
return false;
if (this.TextPosition != other.TextPosition)
return false;
if (this.CharOffset != other.CharOffset)
return false;
if (this.Visible != other.Visible)
return false;
if (this.font.Equals (other.font) && this.color.Equals (other.color) && this.back_color.Equals (other.back_color))
if (this.font.Equals (other.font) && this.color.Equals (other.color))
return true;
return false;
@@ -485,17 +409,11 @@ namespace System.Windows.Forms
return null;
}
public static bool FormatText (Line line, int formatStart, int length, Font font, Color color, Color backColor, FormatSpecified specified)
{
return FormatText (line, formatStart, length, font, color, backColor, TextPositioning.Normal, 0, true, specified);
}
/// <summary>Applies 'font' and 'brush' to characters starting at 'start' for 'length' chars;
/// Removes any previous tags overlapping the same area;
/// returns true if lineheight has changed</summary>
/// <param name="formatStart">1-based character position on line</param>
public static bool FormatText (Line line, int formatStart, int length, Font font, Color color, Color backColor,
TextPositioning text_position, float char_offset, bool visible, FormatSpecified specified)
public static bool FormatText (Line line, int formatStart, int length, Font font, Color color, Color backColor, FormatSpecified specified)
{
LineTag tag;
LineTag start_tag;
@@ -504,7 +422,7 @@ namespace System.Windows.Forms
bool retval = false; // Assume line-height doesn't change
// Too simple?
if (((FormatSpecified.Font & specified) == FormatSpecified.Font) && font.Height != line.TextHeight)
if (((FormatSpecified.Font & specified) == FormatSpecified.Font) && font.Height != line.height)
retval = true;
line.recalc = true; // This forces recalculation of the line in RecalculateDocument
@@ -518,7 +436,7 @@ namespace System.Windows.Forms
// Common special case
if ((formatStart == 1) && (length == tag.Length)) {
SetFormat (tag, font, color, backColor, text_position, char_offset, visible, specified);
SetFormat (tag, font, color, backColor, specified);
return retval;
}
@@ -526,7 +444,7 @@ namespace System.Windows.Forms
// we only need one new tag
if (formatStart == 1 && length == 0) {
line.tags.Break (1);
SetFormat (line.tags, font, color, backColor, text_position, char_offset, visible, specified);
SetFormat (line.tags, font, color, backColor, specified);
return retval;
}
@@ -537,7 +455,7 @@ namespace System.Windows.Forms
// Find Tag will return tag 0 at position 3, but we should just
// use the empty tag after..
if (start_tag.End == formatStart && length == 0 && start_tag.Next != null && start_tag.Next.Length == 0) {
SetFormat (start_tag.Next, font, color, backColor, text_position, char_offset, visible, specified);
SetFormat (start_tag.Next, font, color, backColor, specified);
return retval;
}
@@ -545,22 +463,13 @@ namespace System.Windows.Forms
while (start_tag.End == formatStart && start_tag.Next != null)
start_tag = start_tag.Next;
if (start_tag.Start == formatStart && start_tag.Length == length) {
SetFormat (start_tag, font, color, backColor, text_position, char_offset, visible, specified);
return retval;
}
// Break the tag if needed -- we don't need to break for the start if we're starting at its start.
if (start_tag.Start != formatStart)
tag = start_tag.Break (formatStart);
else
tag = start_tag;
tag = start_tag.Break (formatStart);
// empty selection style at end of line - its the only situation
// where the rest of the tag would be empty, since we moved to the
// begining of next non empty tag
if (tag.Length == 0) {
SetFormat (tag, font, color, backColor, text_position, char_offset, visible, specified);
SetFormat (tag, font, color, backColor, specified);
return retval;
}
@@ -568,27 +477,25 @@ namespace System.Windows.Forms
// after our new (now) empty one..
if (length == 0) {
tag.Break (formatStart);
SetFormat (tag, font, color, backColor, text_position, char_offset, visible, specified);
SetFormat (tag, font, color, backColor, specified);
return retval;
}
bool atEnd = false;
while (tag != null && tag.End <= end) {
SetFormat (tag, font, color, backColor, text_position, char_offset, visible, specified);
atEnd |= tag.End == end;
SetFormat (tag, font, color, backColor, specified);
tag = tag.next;
}
// did the last tag conveniently fit?
if (atEnd || (tag != null && tag.End == end))
if (tag != null && tag.End == end)
return retval;
// Now do the last tag
/// Now do the last tag
end_tag = FindTag (line, end-1);
if (end_tag != null) {
end_tag.Break (end);
SetFormat (end_tag, font, color, backColor, text_position, char_offset, visible, specified);
SetFormat (end_tag, font, color, backColor, specified);
}
return retval;
@@ -602,7 +509,6 @@ namespace System.Windows.Forms
int low = start;
int high = low + Length;
int length_no_ending = line.TextLengthWithoutEnding ();
float char_mid;
if (Length == 0)
return low-1;
@@ -611,8 +517,7 @@ namespace System.Windows.Forms
return 0;
if (x < line.widths [low]) {
char_mid = (line.widths [1] + line.widths [0]) / 2;
if (low == 1 && x >= char_mid)
if (low == 1 && x > (line.widths [1] / 2))
return low;
return low - 1;
}
@@ -630,9 +535,9 @@ namespace System.Windows.Forms
high = mid;
}
char_mid = (line.widths [high] + line.widths [low]) / 2;
float char_width = line.widths[high] - line.widths[low];
if (x >= char_mid)
if ((x - line.widths[low]) >= (char_width / 2))
return high;
else
return low;
@@ -663,12 +568,6 @@ namespace System.Windows.Forms
}
private static void SetFormat (LineTag tag, Font font, Color color, Color back_color, FormatSpecified specified)
{
SetFormat (tag, font, color, back_color, TextPositioning.Normal, 0, true, specified);
}
private static void SetFormat (LineTag tag, Font font, Color color, Color back_color, TextPositioning text_position,
float char_offset, bool visible, FormatSpecified specified)
{
if ((FormatSpecified.Font & specified) == FormatSpecified.Font) {
tag.Font = font;
@@ -678,52 +577,28 @@ namespace System.Windows.Forms
if ((FormatSpecified.BackColor & specified) == FormatSpecified.BackColor) {
tag.back_color = back_color;
}
if ((FormatSpecified.TextPosition & specified) == FormatSpecified.TextPosition)
tag.TextPosition = text_position;
if ((FormatSpecified.CharOffset & specified) == FormatSpecified.CharOffset)
tag.CharOffset = char_offset;
if ((FormatSpecified.Visibility & specified) == FormatSpecified.Visibility)
tag.Visible = visible;
// Console.WriteLine ("setting format: {0} {1} new color {2}", color.Color, specified, tag.color.Color);
}
public virtual SizeF SizeOfPosition (Graphics dc, int pos)
{
if ((pos >= line.TextLengthWithoutEnding () && line.document.multiline) || !visible)
if (pos >= line.TextLengthWithoutEnding () && line.document.multiline)
return SizeF.Empty;
string text = line.text.ToString (pos, 1);
switch ((int)text [0]) {
switch ((int) text [0]) {
case '\t':
if (!line.document.multiline)
goto case 10;
SizeF res = TextBoxTextRenderer.MeasureText (dc, " ", FontToDisplay); // This way we get the height, not that it is ever used...
float left = line.widths [pos];
float right = -1;
TabStopCollection stops = line.tab_stops;
float tabPos;
for (int i = 0; i < stops.Count; i++) {
tabPos = stops [i].Position;
if (tabPos >= left) {
if (tabPos <= line.document.viewport_width - line.RightIndent)
break; // Can't use tabs that are past the end of the line.
right = stops [i].CalculateRight (line, pos);
break;
}
}
if (right < 0) {
float maxWidth = dc.DpiX / 2; // tab stops are 1/2"
right = (float)(Math.Floor (left / maxWidth) + 1) * maxWidth;
}
res.Width = right - left;
SizeF res = TextBoxTextRenderer.MeasureText (dc, " ", font);
res.Width *= 8.0F;
return res;
case 10:
case 13:
return TextBoxTextRenderer.MeasureText (dc, "\u000D", FontToDisplay);
return TextBoxTextRenderer.MeasureText (dc, "\u000D", font);
}
return TextBoxTextRenderer.MeasureText (dc, text, FontToDisplay);
return TextBoxTextRenderer.MeasureText (dc, text, font);
}
public virtual string Text ()
@@ -1614,7 +1614,7 @@ namespace System.Windows.Forms
private bool KeySearch (Keys key)
{
char c = (char) key;
if (!Char.IsLetterOrDigit (c) || SelectionMode == SelectionMode.None)
if (!Char.IsLetterOrDigit (c))
return false;
int idx = FindString (c.ToString (), SelectedIndex);
@@ -326,6 +326,8 @@ namespace System.Windows.Forms {
if (!Checked) {
Checked = true;
}
} else {
Checked = !Checked;
}
base.OnClick (e);
File diff suppressed because it is too large. Load diff
@@ -1,258 +0,0 @@
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2015 Karl Scowen
//
// Authors:
// Karl Scowen <[email protected]>
//
//
using System;
using System.Collections.Generic;
namespace System.Windows.Forms {
abstract class TabStop : IComparable<TabStop> {
float _pos = -1;
internal float Position {
get {
return _pos;
}
set {
if (_pos >= 0)
throw new InvalidOperationException ("Can't change Position once it has been set!");
_pos = value;
}
}
internal virtual float GetInitialWidth (Line line, int pos)
{
return 0;
}
internal abstract float CalculateRight (Line line, int pos);
public override bool Equals (object obj)
{
return obj.GetType () == this.GetType () && Math.Abs (((TabStop)obj).Position - Position) < 0.01;
}
public override int GetHashCode ()
{
return this.GetType ().GetHashCode () ^ Position.GetHashCode ();
}
public override string ToString ()
{
return string.Format ("[{0}: Position {1}]", this.GetType().Name, Position);
}
#region IComparable implementation
public int CompareTo (TabStop other)
{
return Position.CompareTo (other.Position);
}
#endregion
}
class LeftTabStop : TabStop {
internal LeftTabStop ()
{
}
internal LeftTabStop (float position)
{
Position = position;
}
internal override float GetInitialWidth (Line line, int pos)
{
return Position - line.widths[pos];
}
internal override float CalculateRight (Line line, int pos)
{
return Position;
}
}
class CentredTabStop : TabStop {
internal override float CalculateRight (Line line, int pos)
{
int endIndex = line.Text.IndexOfAny (new [] {'\t', '\n', '\r'}, pos + 1); // pos is this tab's index, so look after that.
if (endIndex < 0)
endIndex = line.text.Length;
float textWidth = line.widths [endIndex] - line.widths [pos + 1]; // We use the position after this tabstop, hence pos + 1.
return Math.Max (Position - textWidth / 2f, line.widths [pos]); // We want the width until the start of the text, which is before Position, but we can't go below zero.
}
}
internal class RightTabStop : TabStop {
internal override float CalculateRight (Line line, int pos)
{
int endIndex = line.Text.IndexOfAny (new [] {'\t', '\n', '\r'}, pos + 1); // pos is this tab's index, so look after that.
return calcWidth (line, pos, endIndex);
}
protected float calcWidth (Line line, int pos, int endIndex)
{
if (endIndex < 0)
endIndex = line.text.Length;
float textWidth = line.widths [endIndex] - line.widths [pos + 1]; // We use the position after this tabstop, hence pos + 1.
return Math.Max (Position - textWidth, line.widths [pos]);
}
}
internal class DecimalTabStop : RightTabStop {
internal override float CalculateRight (Line line, int pos)
{
// This is simply a right-align tabstop that regards the decimal as the end.
int endIndex = line.Text.IndexOfAny (new [] {'\t', '\n', '\r', '.'}, pos + 1); // pos is this tab's index, so look after that.
return calcWidth (line, pos, endIndex);
}
}
internal class TabStopCollection : IList<TabStop> {
SortedList<TabStop, TabStop> tabs = new SortedList<TabStop, TabStop> ();
public TabStopCollection Clone ()
{
var n = new TabStopCollection ();
foreach (var tab in tabs.Keys) {
n.tabs.Add (tab, null);
}
return n;
}
public int IndexOf (TabStop tab)
{
return tabs.IndexOfKey (tab);
}
public void Insert (int index, TabStop item)
{
throw new NotSupportedException ("Not relevant to sorted data!");
}
public void RemoveAt (int index)
{
tabs.RemoveAt (index);
}
public TabStop this [int index] {
get {
return tabs.Keys [index];
}
set {
throw new NotSupportedException ("Not relevant to sorted data!");
}
}
#region ICollection implementation
public void Add (TabStop tab)
{
tabs.Add (tab, null);
}
public void Clear ()
{
tabs.Clear ();
}
public bool Contains (TabStop tab)
{
return tabs.ContainsKey (tab);
}
public void CopyTo (TabStop[] array, int arrayIndex)
{
tabs.Keys.CopyTo (array, arrayIndex);
}
public TabStop[] ToArray ()
{
var arr = new TabStop [Count];
CopyTo (arr, 0);
return arr;
}
public int[] ToPosArray ()
{
var arr = new int [Count];
for (int i = 0; i < Count; i++) {
arr [i] = (int)this [i].Position;
}
return arr;
}
public bool Remove (TabStop tab)
{
return tabs.Remove (tab);
}
public int Count {
get {
return tabs.Count;
}
}
bool ICollection<TabStop>.IsReadOnly {
get {
return false;
}
}
#endregion
#region IEnumerable implementation
public IEnumerator<TabStop> GetEnumerator ()
{
return tabs.Keys.GetEnumerator ();
}
#endregion
#region IEnumerable implementation
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
{
return GetEnumerator ();
}
#endregion
public override bool Equals (object obj)
{
var other = obj as TabStopCollection;
if (other == null || other.Count != this.Count)
return false;
for (int i = 0; i < Count; i++) {
if (!tabs.Keys [i].Equals (other.tabs.Keys [i]))
return false;
}
return true;
}
public override int GetHashCode ()
{
// I don't like warnings, but I honestly don't care about the hash code.
return base.GetHashCode ();
}
}
}
@@ -284,8 +284,8 @@ namespace System.Windows.Forms
{
if (control == null)
throw new ArgumentNullException ();
if (value < 1)
throw new ArgumentOutOfRangeException ();
if (value < -1)
throw new ArgumentException ();
column_spans[control] = value;
@@ -310,8 +310,8 @@ namespace System.Windows.Forms
{
if (control == null)
throw new ArgumentNullException ();
if (value < 1)
throw new ArgumentOutOfRangeException ();
if (value < -1)
throw new ArgumentException ();
row_spans[control] = value;
@@ -21,7 +21,6 @@
//
// Authors:
// Peter Bartok [email protected]
// Karl Scowen <[email protected]>
//
//
@@ -117,7 +116,8 @@ namespace System.Windows.Forms
current_link = null;
show_caret_w_selection = (this is TextBox);
document = new Document(this);
document.SizeChanged += new EventHandler<Document.SizeChangedEventArgs> (document_SizeChanged);
document.WidthChanged += new EventHandler(document_WidthChanged);
document.HeightChanged += new EventHandler(document_HeightChanged);
//document.CaretMoved += new EventHandler(CaretMoved);
document.Wrap = false;
click_last = DateTime.Now;
@@ -296,7 +296,8 @@ namespace System.Windows.Forms
if (value == actual_border_style)
return;
Invalidate ();
if (actual_border_style != BorderStyle.Fixed3D || value != BorderStyle.Fixed3D)
Invalidate ();
actual_border_style = value;
document.UpdateMargins ();
@@ -616,10 +617,7 @@ namespace System.Windows.Forms
Line line = null;
for (int i = 1; i <= document.Lines; i++) {
line = document.GetLine (i);
if (i == document.Lines)
sb.Append(line.TextWithoutEnding ());
else
sb.Append(line.text.ToString ());
sb.Append(line.text.ToString ());
}
return sb.ToString();
@@ -1823,7 +1821,6 @@ namespace System.Windows.Forms
}
document.PositionCaret(e.X + document.ViewPortX, e.Y + document.ViewPortY);
document.DisplayCaret ();
if (dbliclick) {
switch (click_mode) {
@@ -2045,24 +2042,22 @@ namespace System.Windows.Forms
Invalidate();
}
internal bool CalculateScrollBars ()
internal void CalculateScrollBars ()
{
var old_canvas_width = canvas_width;
// FIXME - need separate calculations for center and right alignment
SizeControls ();
if (document.Width > document.ViewPortWidth) {
if (document.Width >= document.ViewPortWidth) {
hscroll.SetValues (0, Math.Max (1, document.Width), -1,
document.ViewPortWidth < 0 ? 0 : document.ViewPortWidth);
if (document.multiline)
hscroll.Enabled = true;
} else {
hscroll.Enabled = false;
hscroll.Value = hscroll.Minimum;
hscroll.Maximum = document.ViewPortWidth;
}
if (document.Height > document.ViewPortHeight) {
if (document.Height >= document.ViewPortHeight) {
vscroll.SetValues (0, Math.Max (1, document.Height), -1,
document.ViewPortHeight < 0 ? 0 : document.ViewPortHeight);
if (document.multiline)
@@ -2113,16 +2108,16 @@ namespace System.Windows.Forms
PositionControls ();
SizeControls (); //Update sizings now we've decided whats visible
return (canvas_width != old_canvas_width);
}
private void document_SizeChanged (object sender, Document.SizeChangedEventArgs e)
private void document_WidthChanged (object sender, EventArgs e)
{
var canvas_width_changed = CalculateScrollBars ();
if (e.HeightChanged && canvas_width_changed)
CalculateDocument (); // Viewport has changed due to the document change, update the document.
// TODO: technically the opposite situation could happen too, where a document width change causes a change in canvas height.
CalculateScrollBars();
}
private void document_HeightChanged (object sender, EventArgs e)
{
CalculateScrollBars();
}
private void ScrollLinks (int xChange, int yChange)
@@ -2315,41 +2310,40 @@ namespace System.Windows.Forms
// If the caret moves to the left outside the visible area, we jump the document into view, not just one
// character, but 1/3 of the width of the document
// If the caret moves to the right outside the visible area, we scroll just enough to keep the caret visible
// For comparison, in Windows 8.1 / .Net 4:
// Multiline: as above, but 1/4
// Single line: either direction with the cursors jumps 1/4
// Both are irrespective of alignment.
// Handle horizontal scrolling
// Check if we moved out of view to the left
if (pos.X < (document.ViewPortX)) {
do {
var newVal = hscroll.Value - document.ViewPortWidth / 3 - 1; // - 1 so that we're guaranteed to move, even if document.ViewPortWidth is < 3.
if (newVal >= hscroll.Minimum) {
hscroll.SafeValueSet (newVal);
} else {
hscroll.Value = hscroll.Minimum;
}
} while (hscroll.Value > pos.X);
}
if (document.CaretLine.alignment == HorizontalAlignment.Left) {
// Check if we moved out of view to the left
if (pos.X < (document.ViewPortX)) {
do {
if ((hscroll.Value - document.ViewPortWidth / 3) >= hscroll.Minimum) {
hscroll.SafeValueSet (hscroll.Value - document.ViewPortWidth / 3);
} else {
hscroll.Value = hscroll.Minimum;
}
} while (hscroll.Value > pos.X);
}
// Check if we moved out of view to the right
if ((pos.X >= (document.ViewPortWidth + document.ViewPortX)) && (hscroll.Value != hscroll.Maximum)) {
int newVal;
if (Multiline) {
newVal = pos.X - document.ViewPortWidth + 1;
} else {
newVal = pos.X - document.ViewPortWidth * 2 / 3 + 1;
}
if (newVal <= hscroll.Maximum - document.ViewPortWidth + 1) {
if (newVal >= 0) {
hscroll.SafeValueSet (newVal);
// Check if we moved out of view to the right
if ((pos.X >= (document.ViewPortWidth + document.ViewPortX)) && (hscroll.Value != hscroll.Maximum)) {
if ((pos.X - document.ViewPortWidth + 1) <= hscroll.Maximum) {
if (pos.X - document.ViewPortWidth >= 0) {
hscroll.SafeValueSet (pos.X - document.ViewPortWidth + 1);
} else {
hscroll.Value = 0;
}
} else {
hscroll.Value = 0;
hscroll.Value = hscroll.Maximum;
}
} else {
hscroll.Value = hscroll.Maximum - document.ViewPortWidth + 1;
}
} else if (document.CaretLine.alignment == HorizontalAlignment.Right) {
// hscroll.Value = pos.X;
// if ((pos.X > (this.canvas_width + document.ViewPortX)) && (hscroll.Enabled && (hscroll.Value != hscroll.Maximum))) {
// hscroll.Value = hscroll.Maximum;
// }
} else {
// FIXME - implement center cursor alignment
}
if (Text.Length > 0)
@@ -2359,10 +2353,7 @@ namespace System.Windows.Forms
return;
// Handle vertical scrolling
height = document.CaretLine.Height;
if (document.CaretLine.line_no < document.Lines)
height += 1; // Add a bit of room on the bottom if there are more lines - but don't scroll past the bottom when ther aren't.
height = document.CaretLine.Height + 1;
if (pos.Y < document.ViewPortY)
vscroll.SafeValueSet (pos.Y);
File diff suppressed because it is too large. Load diff
@@ -383,36 +383,26 @@ namespace System.Windows.Forms
[EditorBrowsable (EditorBrowsableState.Never)]
public new void Show ()
{
Show (Location);
}
public void Show (int x, int y)
{
Show (new Point (x, y));
Show (Location, DefaultDropDownDirection);
}
public void Show (Point screenLocation)
{
SetOwnerControl (null);
Show (screenLocation, DefaultDropDownDirection);
}
public void Show (Control control, int x, int y)
{
Show (control, new Point (x, y));
}
public void Show (Control control, Point position)
{
Show (control, position, DefaultDropDownDirection);
}
public void Show (Control control, Point position, ToolStripDropDownDirection direction)
public void Show (Control control, Point position)
{
if (control == null)
throw new ArgumentNullException ("control");
SetOwnerControl (control);
Show (control.PointToScreen (position), direction);
XplatUI.SetOwner (Handle, control.Handle);
Show (control.PointToScreen (position), DefaultDropDownDirection);
}
public void Show (int x, int y)
{
Show (new Point (x, y), DefaultDropDownDirection);
}
public void Show (Point position, ToolStripDropDownDirection direction)
@@ -532,17 +522,26 @@ namespace System.Windows.Forms
this.OnOpened (EventArgs.Empty);
}
public void Show (Control control, int x, int y)
{
if (control == null)
throw new ArgumentNullException ("control");
Show (control, new Point (x, y));
}
public void Show (Control control, Point position, ToolStripDropDownDirection direction)
{
if (control == null)
throw new ArgumentNullException ("control");
XplatUI.SetOwner (Handle, control.Handle);
Show (control.PointToScreen (position), direction);
}
#endregion
#region Protected Methods
protected virtual void SetOwnerControl (Control ownerControl)
{
var ownerControlHandle = (ownerControl == null) ? IntPtr.Zero : ownerControl.Handle;
XplatUI.SetOwner (Handle, ownerControlHandle);
}
protected override AccessibleObject CreateAccessibilityInstance ()
{
return new ToolStripDropDownAccessibleObject (this);
@@ -419,8 +419,10 @@ namespace System.Windows.Forms
if (item.Owner == null)
return null;
if (item.Owner is ContextMenuStrip ownerContextMenuStrip)
return ownerContextMenuStrip.SourceControl?.TopLevelControl;
if (item.Owner is ContextMenuStrip) {
Control container = ((ContextMenuStrip)item.Owner).container;
return container == null ? null : container.TopLevelControl;
}
// MainMenuStrip
return item.Owner.TopLevelControl;
@@ -1419,7 +1419,7 @@ namespace System.Windows.Forms {
private void Draw (Rectangle clip, Graphics dc)
{
dc.FillRectangle (BackColorBrush, clip);
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), clip);
if (dash == null)
CreateDashPen ();
@@ -1670,6 +1670,7 @@ namespace System.Windows.Forms {
{
if (!full_row_select || show_lines)
DrawSelectionAndFocus(node, dc, node.Bounds);
Font font = node.NodeFont;
if (node.NodeFont == null)
@@ -1690,7 +1691,7 @@ namespace System.Windows.Forms {
int middle = y + (ActualItemHeight / 2);
if (full_row_select && !show_lines) {
var r = new Rectangle (1, y, ViewportRectangle.Width - 2, ActualItemHeight);
Rectangle r = new Rectangle (1, y, ViewportRectangle.Width - 2, ActualItemHeight);
DrawSelectionAndFocus (node, dc, r);
}
@@ -1715,25 +1716,26 @@ namespace System.Windows.Forms {
}
if (draw_mode != TreeViewDrawMode.Normal) {
dc.FillRectangle (BackColorBrush, node.Bounds);
var tree_node_state = TreeNodeStates.Default;;
dc.FillRectangle (Brushes.White, node.Bounds);
TreeNodeStates tree_node_state = TreeNodeStates.Default;;
if (node.IsSelected)
tree_node_state = TreeNodeStates.Selected;
if (node.Checked)
tree_node_state |= TreeNodeStates.Checked;
if (node == focused_node)
tree_node_state |= TreeNodeStates.Focused;
var node_bounds = node.Bounds;
if (draw_mode != TreeViewDrawMode.OwnerDrawText) {
Rectangle node_bounds = node.Bounds;
if (draw_mode == TreeViewDrawMode.OwnerDrawText) {
node_bounds.X += 3;
node_bounds.Y += 1;
} else {
node_bounds.X = 0;
node_bounds.Width = Width;
}
var e = new DrawTreeNodeEventArgs (dc, node, node_bounds, tree_node_state);
DrawTreeNodeEventArgs e = new DrawTreeNodeEventArgs (dc, node, node_bounds, tree_node_state);
OnDrawNode (e);
OnDrawNode (e);
if (!e.DrawDefault)
return;
}
@@ -416,11 +416,6 @@ namespace System.Windows.Forms {
return 0;
}
if (vkey == 0) {
buffer = String.Empty;
return 0;
}
XEvent e = new XEvent ();
e.AnyEvent.type = XEventName.KeyPress;
e.KeyEvent.display = display;
@@ -445,15 +440,6 @@ namespace System.Windows.Forms {
e.KeyEvent.state |= AltGrMask;
if ((vkey >= (int) VirtualKeys.VK_NUMPAD0) && (vkey <= (int) VirtualKeys.VK_NUMPAD9))
e.KeyEvent.keycode = XKeysymToKeycode (display, vkey - (int) VirtualKeys.VK_NUMPAD0 + (int) KeypadKeys.XK_KP_0);
if (vkey == (int) VirtualKeys.VK_DECIMAL)
e.KeyEvent.keycode = XKeysymToKeycode (display, (int) KeypadKeys.XK_KP_Decimal);
if (vkey == (int) VirtualKeys.VK_SEPARATOR)
e.KeyEvent.keycode = XKeysymToKeycode(display, (int) KeypadKeys.XK_KP_Separator);
for (int keyc = min_keycode; (keyc <= max_keycode) && (e.KeyEvent.keycode == 0); keyc++) {
// find keycode that could have generated this vkey
if ((keyc2vkey [keyc] & 0xFF) == vkey) {
@@ -466,6 +452,15 @@ namespace System.Windows.Forms {
}
}
if ((vkey >= (int) VirtualKeys.VK_NUMPAD0) && (vkey <= (int) VirtualKeys.VK_NUMPAD9))
e.KeyEvent.keycode = XKeysymToKeycode (display, vkey - (int) VirtualKeys.VK_NUMPAD0 + (int) KeypadKeys.XK_KP_0);
if (vkey == (int) VirtualKeys.VK_DECIMAL)
e.KeyEvent.keycode = XKeysymToKeycode (display, (int) KeypadKeys.XK_KP_Decimal);
if (vkey == (int) VirtualKeys.VK_SEPARATOR)
e.KeyEvent.keycode = XKeysymToKeycode(display, (int) KeypadKeys.XK_KP_Separator);
if (e.KeyEvent.keycode == 0 && vkey != (int) VirtualKeys.VK_NONAME) {
// And I couldn't find the keycode so i returned the vkey and was like whatever
Console.Error.WriteLine ("unknown virtual key {0:X}", vkey);
@@ -1218,7 +1213,7 @@ namespace System.Windows.Forms {
if (xic != IntPtr.Zero && have_Xutf8LookupString && xevent.type == XEventName.KeyPress) {
do {
try {
res = Xutf8LookupString (xic, ref xevent, lookup_byte_buffer, lookup_byte_buffer.Length, out keysym_res, out status);
res = Xutf8LookupString (xic, ref xevent, lookup_byte_buffer, 100, out keysym_res, out status);
} catch (EntryPointNotFoundException) {
have_Xutf8LookupString = false;
@@ -1236,10 +1231,8 @@ namespace System.Windows.Forms {
return s.Length;
} else {
IntPtr statusPtr = IntPtr.Zero;
res = XLookupString (ref xevent, lookup_byte_buffer, len, out keysym_res, out statusPtr);
lookup_buffer.Length = 0;
string s = Encoding.ASCII.GetString (lookup_byte_buffer, 0, res);
lookup_buffer.Append (s);
res = XLookupString (ref xevent, lookup_buffer, len, out keysym_res, out statusPtr);
keysym = (XKeySym) keysym_res.ToInt32 ();
return res;
}
@@ -1305,7 +1298,7 @@ namespace System.Windows.Forms {
private static extern bool XSetLocaleModifiers (string mods);
[DllImport ("libX11")]
internal extern static int XLookupString(ref XEvent xevent, byte [] buffer, int num_bytes, out IntPtr keysym, out IntPtr status);
internal extern static int XLookupString(ref XEvent xevent, StringBuilder buffer, int num_bytes, out IntPtr keysym, out IntPtr status);
[DllImport ("libX11")]
internal extern static int Xutf8LookupString(IntPtr xic, ref XEvent xevent, byte [] buffer, int num_bytes, out IntPtr keysym, out XLookupStatus status);
Loaded 100 of 524 files, more files were not shown because too many files have changed in this diff. Show more